2012-12-31 61 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)用于返回支持的方向。

相关问题