应用程序由于InterfaceOrientation而崩溃
问题描述:
我的应用程序基于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
答
shouldAutorotateToInterfaceOrientation只返回东西,File's Owner and View
之间的连接,如果查看不会附加文件的所有者它会崩溃。
答
将应该替换为和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.
}
答
您应该使用UIInterfaceOrientationMaskLandscape代替UIInterfaceOrientationLandscapeLeft & UIInterfaceOrientationLandscapeRight。在iOS SDK 6.0+中,新的枚举(UIInterfaceOrientationMask)用于返回支持的方向。
您可以发布 – thavasidurai
http://*.com/questions/13911080/how-to-launch-app-in-landscape-frustrated/13911169#13911169 –
你在视图中使用图片选择器的代码?你是否将其设置为rootview? –