2012-02-01 92 views
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选项设置的。只要我在纵向模式下回到父视图,每个想法都可以正常工作。

回答

0

问题在于您使用的autoresizingMask。