ios - 一个横向 Controller

标签 ios uinavigationcontroller orientation landscape

我有一个应用程序,它由一个包含 4 个导航 Controller 的标签栏 Controller 组成。我找不到任何解决方案让导航 Controller 层次结构中的一个 Controller 仅处于横向模式。所有其他 Controller 都应该是纵向的。感谢在此问题上的任何帮助。

最佳答案

在你想要横屏的导航 Controller 的viewDidLoad():中,包含:

let value = UIInterfaceOrientation.LandscapeLeft.rawValue
UIDevice.currentDevice().setValue(value, forKey: "orientation")

一定要添加以下重写

override func shouldAutorotate() -> Bool {
    return true
}

关于ios - 一个横向 Controller ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33374029/

相关文章:

ios - 如何设置自定义 UIView 属性

ios - 如何在 iPhone X 上信箱 SpriteKit 游戏?

ios - AVCapture 似乎滞后,文本识别不会立即开始

objective-c - iPhone 模态视图动画帮助

ios - 为什么 UIView.animate 可以使用交互式 Controller 转换,而 UIViewPropertyAnimator 不能?

cocoa-touch - 隐藏的 UIView 方向更改/布局问题

ios - SIP SDK(不支持 IPv6)集成在 iOS 应用程序中...此应用程序是否获得 AppStore 的批准?

ios - 快速更改 contactUI 'forNewContact' 的标题

xcode - 横向呈现ModalViewController

ios - iOS 7.1 或 iPhone 横向中的方向问题