2010-10-27 159 views
0

我有代碼來旋轉和調整滾動視圖,這樣,當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; 
      }]; 
     } 
    }]; 

我在想什麼?

感謝

回答

0

您確認的UIScrollView的父視圖不重鋪設出來,當你轉動?也許你需要在- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation做最後的調整大小,所以框架不會被調整超出你的控制。