2011-03-11 73 views

回答

0

據我所知,在景觀中不應該有任何問題。當然,我還沒有嘗試過這些代碼,所以我不能做出任何承諾。

我想象中的問題是中心按鈕在旋轉後不居中。我猜想,解決這一問題的最簡單方法是使用下面的代碼

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { 
    CGFloat heightDifference = buttonImage.size.height - self.tabBar.frame.size.height; 
    if (heightDifference < 0) { 
     button.center = self.tabBar.center; 
    } else { 
     CGPoint center = self.tabBar.center; 
     center.y = center.y - heightDifference/2.0; 
     button.center = center; 
    } 
} 

上面的代碼假定button是一個實例變量。

,如果你想要做的事更看中我想,你應該重寫以下方法:

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration 

和動畫按鈕的中心,但我不會爲提供代碼。

我沒有運行我提供的代碼,但我認爲它應該工作。如果沒有,請留下評論,我會看看我能做些什麼來改善它。