【发布时间】:2017-04-07 20:55:06
【问题描述】:
我有一个案例需要在我的应用程序中创建一个新的UIWindow。我还希望将新窗口锁定为纵向,但我的应用的原始窗口应该不锁定为纵向。
我正在像这样设置我的新窗口:
newWindow = UIWindow(frame: CGRect(x: 0, y: 0, width: view.bounds.width, height: view.bounds.height))
newWindow?.rootViewController = ViewController2()
newWindow?.makeKeyAndVisible()
而ViewController2 使用以下方式锁定方向:
override var shouldAutorotate: Bool {
return false
}
问题是,当显示新窗口,并且用户旋转设备时,应用程序本身会锁定纵向,但状态栏会旋转到横向模式:
如何确保状态栏在我的新窗口中也锁定为纵向?
如果有人想在一个简单的项目中看到这一点:https://github.com/rajohns08/StatusBar
【问题讨论】: