Iphone 由于接口定向,应用程序崩溃
我的应用程序基于Iphone 由于接口定向,应用程序崩溃,iphone,ios,xcode,uiinterfaceorientation,Iphone,Ios,Xcode,Uiinterfaceorientation,我的应用程序基于横向。当应用程序在我的设备上运行时,应用程序立即崩溃 我选择了这两个字段 UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight 我得到这个错误: 由于未捕获异常而终止应用程序 UIApplicationInvalidinInterfaceOrientation,原因:支持 方向与应用程序没有共同的方向,并且 shouldAutorotate正在返回是 AutoRotateTointerF
横向。当应用程序在我的设备上运行时,应用程序立即崩溃
我选择了这两个字段
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
我得到这个错误:
由于未捕获异常而终止应用程序
UIApplicationInvalidinInterfaceOrientation,原因:支持
方向与应用程序没有共同的方向,并且
shouldAutorotate正在返回是
AutoRotateTointerFaceOrientation是否只返回您希望支持的那些
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return ((interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight));
}
请再检查一件事,文件所有者和视图之间的连接
,如果视图不与文件所有者连接,它将崩溃。向控制器添加应自动旋转和支持的接口方向方法
-(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,而不是UIInterfaceOrientationAndScapeLeft&UIInterfaceOrientationAndScapeRight。在iOS SDK 6.0+中,新的枚举(UIInterfaceOrientationTask)用于返回支持的方向。您是否在该视图中使用图像选择器?是否将其设置为rootview?是否在项目摘要中设置了任何支持的接口方向。