2011-03-11 71 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 

和动画按钮的中心,但我不会为提供代码。

我没有运行我提供的代码,但我认为它应该工作。如果没有,请留下评论,我会看看我能做些什么来改善它。