应用程序由于InterfaceOrientation而崩溃 [英] Application is crashed due to InterfaceOrientation

查看:89
本文介绍了应用程序由于InterfaceOrientation而崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序基于 Landscape .当应用程序在我的设备上运行时,该应用程序立即崩溃.

My application is Landscape based. The app crashes immediately when the app runs on my device.

我选择了这两个字段

UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight

我收到此错误:

由于未捕获的异常而终止应用程序UIApplicationInvalidInterfaceOrientation,原因:受支持方向与应用程序没有共同的方向,并且shouldAutorotate返回YES

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

推荐答案

向控制器添加 shouldAutorotate 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.

}

这篇关于应用程序由于InterfaceOrientation而崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆