2013-02-25 77 views
1

我的项目设置指示风景向左和向右是支持的接口方向。 当我的应用程序启动时,模拟器处于横向模式。风景中的设备,但[[UIDevice currentDevice]方向]报告肖像

但是,此NSLog语句(在我的应用程序委托或我的根视图控制器)不会运行。

if (UIInterfaceOrientationIsLandscape([[UIDevice currentDevice] orientation])) { 
    NSLog(@"I'm in landscape"); 
} 

任何想法为什么?

我正在使用iOS6.1。

回答

0

您可以使用委托

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation 
{ 
    return UIInterfaceOrientationLandscapeLeft; 
} 

使用这个代理和应用程序将出现在横向模式或任何期望的方向模式。

试试吧。

相关问题