UIScrollView不能正确调整大小

UIScrollView不能正确调整大小

问题描述:

我有代码来旋转和调整滚动视图,这样,当iPhone横向的方向是正确的。UIScrollView不能正确调整大小

这就是视图看起来像旋转前:
alt text

滚动视图是黄色的。

这是什么样子后:alt text

这是日志语句设置为滚动视图的新框架后,我说,你可以看到,它显然不是它说,它应该是!

CGRect for object after setting to new: UIScrollView, {{0, 100}, {480, 150}} 


    [UIView animateWithDuration:kAnimationDuration animations:^{ 
     CGRect boundsRect = anObject.frame; 
     boundsRect.origin.x = x; 
     boundsRect.origin.y = y; 
     boundsRect.size.width = width; 
     boundsRect.size.height = height; 
     anObject.frame = boundsRect; 
     NSLog(@"CGRect for object after setting to new: %@, %@",[anObject class], NSStringFromCGRect(anObject.frame)); 
    } completion:^ (BOOL finished){ 
     if (finished) { 
      [UIView animateWithDuration:kAnimationDuration animations:^{ 
       anObject.alpha = 1.0; 
      }]; 
     } 
    }]; 

我在想什么?

感谢

您确认的UIScrollView的父视图不重铺设出来,当你转动?也许你需要在- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation做最后的调整大小,所以框架不会被调整超出你的控制。