0
我是從,如果我回去maintableview碰巧我UIScroll鑑於這種奇怪的痛苦父視圖,而在水平格式..的UIScrollView尺寸減小,如果我回去在水平方向
基本上我來的時候回到subview它有滾動視圖它只有近似的滾動視圖的原始大小的一半..
我不知道爲什麼。
這裏是我的uiscrollview中的方法,它加載了我在其中顯示的scrollview和圖像。
- (void)loadImage:(NSString *)myImageName
{
// //Create scrollview
scrollView = [[UIScrollView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
scrollView.delegate = self;
// containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 480, 700)];
//Create scrollviewimage
if ([myImageName isEqualToString:@"one"]) {
image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"hardout.png"]];
containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 480, 320)];
// NSLog(@"1");
}
if ([myImageName isEqualToString:@"two"]) {
image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"kiakaha.png"]];
containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 580, 460)];
// NSLog(@"2");
}
if ([myImageName isEqualToString:@"three"]) {
image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"browheresmychips.png"]];
containerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 560, 660)];
// NSLog(@"3");
}
//Add subview
[containerView addSubview:image];
scrollView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
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];
}
基本上這個方法是從父視圖的indexPath選項設置的。只要我在縱向模式下回到父視圖,每個想法都可以正常工作。