ios - 从横向方向的 iPhone 6 Plus 主屏幕进入纵向方向会导致方向错误

标签 ios iphone ios8 uiinterfaceorientation

这个问题的实际标题比我能容纳的要长:

在 iPhone 6 Plus 上启动其 Root View Controller 仅支持纵向但在其他方面支持横向的应用程序,而主屏幕处于横向方向会导致应用程序的窗口处于横向方向但设备处于纵向。

简而言之,它看起来像这样:

当它应该看起来像这样时:

重现步骤:

  1. 运行 iOS 8.0 的 iPhone 6 Plus。

  2. 一个应用程序,其 plist 支持除纵向倒置之外的所有方向。

  3. 应用的 Root View Controller 是 UITabBarController。

  4. 一切,选项卡栏 Controller 及其所有 subview Controller 都从 supportedInterfaceOrientations 返回 UIInterfaceOrientationMaskPortrait

  5. 从 iOS 主屏幕开始。

  6. 旋转到横向(需要 iPhone 6 Plus)。

  7. 冷启动应用。

  8. 结果:界面方向损坏。

我想不出任何其他方法来强制纵向方向除了完全禁用横向,我做不到:我们的网络浏览器模态视图 Controller 需要横向。

我什至尝试子类化 UITabBarController 并覆盖 supportedInterfaceOrientations 以返回仅纵向 mask ,但这(即使执行了上述所有其他步骤)也没有解决问题。


Here's a link to a sample project showing the bug.


最佳答案

我在 iPhone 6 Plus 上横向启动我们的应用程序时遇到了同样的问题。

我们的解决方法是通过项目设置从 plist 中删除横向支持的界面方向:

Removed landscape orientation

并在应用委托(delegate)中实现 application:supportedInterfaceOrientationsForWindow:

- (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
    return UIInterfaceOrientationMaskAllButUpsideDown;
}

显然,您的 plist 中的信息用于指定允许您的应用启动的方向。

关于ios - 从横向方向的 iPhone 6 Plus 主屏幕进入纵向方向会导致方向错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26003086/

相关文章:

html - Safari 视口(viewport)错误,固定位置和底部或顶部的问题

ios - iPhone 6 和 iPhone 6 Plus 的方向问题

ios-simulator - iOS 8 : Working with resizable iPhone and iPad simulators

iOS 10 UNNotificationAction 发送电子邮件/短信

iphone - 在 UIBarButtonItem setTintColor 上发送的无法识别的选择器

iphone - 修改iphone SDK中的日期选择器

ios - Xcode 6 View 调试不可用

ios - UILabel:自定义下划线颜色?

ios - 滚动到底部时如何为 TableView 实现加载更多?(即上拉刷新)

ios - 使用 ABAddressBookRegisterExternalChangeCallback 注册的地址簿更改回调永远不会被调用 (iOS 8)