當我在滾動視圖中查看圖像時,我改變了手機的方向,scrollview不會改變手機的方向。當方向改變時UIScrollview大小
林想知道如果有人可以向我解釋如何做到這一點。
這些都是在我的界面生成器設置
我剛纔已經做了一些研究,現在有第一選擇工作,但如果我嘗試另一張照片它dosnt工作..和我不能確定爲什麼..我的繼承人代碼
這是什麼使這半工作
scrollView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
- (void)loadImage:(NSString *)myImageName
{
// //Create scrollview
scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
scrollView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
scrollView.delegate = self;
//Create scrollviewimage
if ([myImageName isEqualToString:@"one"]) {
image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hyundai.png"]];
containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 350, 550)];
NSLog(@"1");
}
if ([myImageName isEqualToString:@"two"]) {
image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"keso.png"]];
containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 600, 520)];
NSLog(@"2");
}
if ([myImageName isEqualToString:@"three"]) {
image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"conforti.png"]];
containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 600, 700)];
NSLog(@"3");
}
//Add subview
[containerView addSubview:image];
//initViews
// scrollView.contentSize = containerView.frame.size;
[scrollView addSubview:containerView];
//scrolling
scrollView.minimumZoomScale = 1.0;
scrollView.maximumZoomScale = 31.0;
scrollView.BackgroundColor = UIColor.whiteColor;
[scrollView setZoomScale:scrollView.minimumZoomScale];
//highrachy
[self.view addSubview:scrollView];
scrollView = nil;
}
編輯:應對@D Ĵ
這是輸出
2012-02-01 13:30:35.683 Diagram Test[1672:707] The view controller <UINavigationController: 0x14cdd0> returned NO from -shouldAutorotateToInterfaceOrientation: for all interface orientations. It should support at least one orientation.
2012-02-01 13:30:44.182 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:30:47.097 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:30:47.158 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:30:51.509 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:30:51.555 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:30:55.473 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:30:55.519 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:30:59.293 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:30:59.352 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:31:02.237 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:31:02.281 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:31:03.814 Diagram Test[1672:707] height = (null)i, width = (null)i
2012-02-01 13:31:03.858 Diagram Test[1672:707] height = (null)i, width = (null)i
將圖像添加到UIScrollView的代碼是什麼?其他物體是否改變方向?實際上,在你發佈它之後,就像你有一個UIScrollView佔據整個Iphone屏幕一樣,它可能是你的視圖控制器。 – DJPlayer 2012-02-01 00:22:39