iOS >> 设备方向 >> 屏幕不支持上下颠倒

标签 ios device-orientation

我有一个支持设备方向的屏幕。

一切正常,除了当我倒置旋转设备(主页按钮在顶部)时,旋转不起作用(它停留在最后的横向设置)。

我知道需要更新几个地方来支持这一点:

  • 在 VC 本身中,我添加了以下方法:

enter image description here

  • 在项目目标中,我更新如下:

enter image description here

  • 在 Storyboard VC Scene 中,我更新如下:

enter image description here

我在这里错过了什么?

最佳答案

您还必须允许在当前主视图 Controller 的每个父 View Controller 中旋转到所有方向。例如,如果您的 View Controller 位于导航 Controller 中,请尝试对其进行子类化并覆盖与示例中相同的方法。

编辑:作为@JordanC提到,从 iOS 7 开始,您可以实现 UINavigationControllerDelegate 方法来返回自定义支持的方向:

- (UIInterfaceOrientationMask)navigationControllerSupportedInterfaceOrientations:(UINavigationController *)navigationController

关于iOS >> 设备方向 >> 屏幕不支持上下颠倒,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20123009/

相关文章:

ios - AFNetworking ASPXAUTH Cookies AFHTTPRequestOperationManager

ios - NSUserDefaults removeObjectForKey

iphone - 用 View 覆盖标签栏

javascript - Three.js:使用触摸和设备方向旋转相机

ios - 我怎样才能普遍禁用横向?

javascript - 设备方向事件 : how to deal with crazy gamma when beta approaches/hits 90deg?

iphone - 将 Twitter.framework 添加到 iPhone 上的 Theos

objective-c - 从弱链接的 iOS 类或不在部署目标 iOS 版本中的类继承

ios - Xcode 11 中的构建/存档版本无限期挂起