当我旋转时钟方向时如何设置横向模式

时间:2010-11-27 16:43:54

标签: iphone cocoa-touch

我有app,当我顺时针旋转iphone时,我需要显示我的报告UIViewcontroller只有横向模式。其他UIViewcontroller是Portrait模式。

OtherUIviewController

(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {

    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

报告Uiviewcontroller

   - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{

     return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);

}

但是如何检查时钟明智的方向。任何样本//

1 个答案:

答案 0 :(得分:3)

您需要同时检查UIInterfaceOrientationLandscapeRightUIInterfaceOrientationLandscapeLeft。否则,如果主页按钮指向右侧,则只会旋转屏幕。

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{
     return (interfaceOrientation == UIInterfaceOrientationLandscapeRight)
            || interfaceOrientation == UIInterfaceOrientationLandscapeLeft;
}
相关问题