iOS 8颠倒方向,启用XCode选项,仍然无法正常工作 [英] iOS 8 upside down orientation, XCode option enabled, still doesn't work

查看:91
本文介绍了iOS 8颠倒方向,启用XCode选项,仍然无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iOS8(XCode 6.1.1)中开发了一个通用应用程序。它将支持所有4个方向(左,右,纵向和上下颠倒)。

I have a universal application being developed in iOS8 (XCode 6.1.1). It will support all the 4 orientations (left, right, portrait & upside down).

问题在于,尽管在XCode中支持方向的四个选项被检查,只有左,右和肖像工作正常。那么,XCode或iOS8上是否有错误?我的 info.plist 显示了所有支持的方向,但是当我在模拟器或设备上运行应用程序时,它不会在翻转时翻转方向。 (PS:它是一个单视图应用程序,它没有任何导航控制器)。

The problem is that, although in XCode the four options for supported orientations are checked, only left, right & portrait are working properly. So, is there a bug on XCode or iOS8? My info.plist shows all the supported orientations, but when I run the app on simulator or on the device it doesn't 'flip' the orientation when it's upside down. (PS: it's an singleview app, it doesn't have any navigation controller).

谢谢!

Cleverson

Cleverson

推荐答案

好吧,我已经找到了项目配置选项的目的......在选项中你是说我的应用程序支持这些方向而不是我的应用程序必须使用这四个选项...所以,在iPhone上你必须明确表示特定的ViewController支持所有方向(颠倒不会成为默认方向的一部分,由于我不知道的原因)...代码应该像这样支持所有方向:

Well, I have figured out the purpose of the the options on project configuration... Within the options you're saying "my app support these orientations" and not "my app must use these four options"... So, on iPhone you must explicity say that a particular ViewController support all orientations (the upsidedown doesn't make parte of the default orientations, for a reason that I dont know)... The code should be like this for supporting all orientations:

override func supportedInterfaceOrientations() -> Int{
    return Int(UIInterfaceOrientationMask.All.rawValue)
}

这篇关于iOS 8颠倒方向,启用XCode选项,仍然无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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