2013-02-25 78 views
1

我的項目設置指示風景向左和向右是支持的接口方向。 當我的應用程序啓動時,模擬器處於橫向模式。風景中的設備,但[[UIDevice currentDevice]方向]報告肖像

但是,此NSLog語句(在我的應用程序委託或我的根視圖控制器)不會運行。

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

任何想法爲什麼?

我正在使用iOS6.1。

回答

0

您可以使用委託

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation 
{ 
    return UIInterfaceOrientationLandscapeLeft; 
} 

使用這個代理和應用程序將出現在橫向模式或任何期望的方向模式。

試試吧。

相關問題