2012-12-31 437 views
1

我的應用程序基於Landscape。應用在我的設備上運行時,該應用立即崩潰。應用程序由於InterfaceOrientation而崩潰

我選擇了這兩個領域

UIInterfaceOrientationLandscapeLeft 
UIInterfaceOrientationLandscapeRight 

我收到此錯誤:那些你想支持

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

請一個更

Terminating app due to uncaught exception UIApplicationInvalidInterfaceOrientation, reason: Supported orientations has no common orientation with the application, and shouldAutorotate is returning YES

+2

您可以發佈 – thavasidurai

+0

http://stackoverflow.com/questions/13911080/how-to-launch-app-in-landscape-frustrated/13911169#13911169 –

+1

你在視圖中使用圖片選擇器的代碼?你是否將其設置爲rootview? –

回答

0

shouldAutorotateToInterfaceOrientation只返回東西,File's Owner and View之間的連接,如果查看不會附加文件的所有者它會崩潰。

2

應該替換爲supportedInterfaceOrientations方法到您的控制器。

-(BOOL)shouldAutorotate 
    { 
     return YES; //this will auto-rotate the orientation. 
    } 



-(NSUInteger)supportedInterfaceOrientations 
{ 

    return UIInterfaceOrientationMaskLandscape; // will force the app to load in landscape, you can change it as per your need. 

} 
0

您應該使用UIInterfaceOrientationMaskLandscape代替UIInterfaceOrientationLandscapeLeft & UIInterfaceOrientationLandscapeRight。在iOS SDK 6.0+中,新的枚舉(UIInterfaceOrientationMask)用於返回支持的方向。

相關問題