2010-11-27 40 views
0

我有应用程序,当我旋转iphone的顺时针方向我需要显示我的报告UIViewcontroller只有风景模式。其他UIViewcontroller是肖像模式。如何设置风景模式,当我旋转时钟方向

OtherUIviewController

(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 

    return (interfaceOrientation == UIInterfaceOrientationPortrait); 
} 

报告的UIViewController

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 

    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight); 

} 

但如何检查顺时针方向。任何样品//

回答

3

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

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation 
{ 
    return (interfaceOrientation == UIInterfaceOrientationLandscapeRight) 
      || interfaceOrientation == UIInterfaceOrientationLandscapeLeft; 
} 
+0

这是行不通的,因为我已经试过这个。我需要明智的方向,以及如何检查模拟器。我正在检查旋转模拟器的权利。这是正确的方式。 anyotherway – SOF 2010-11-27 18:11:52