【发布时间】:2016-01-05 05:17:33
【问题描述】:
我的一个应用程序有一个问题,我在将应用程序安装到实际 iPad 上后才发现该问题,无法在模拟器中看到。问题是当我将 iPad 保持在横向时,如果我将 iPad 倾斜到某个角度,iPad 会保持横向模式,但视图会在仍处于横向模式时切换到我的 PortraitView。在我的代码中,我有一个名为 screenRotated() 的函数,它是 UIDeviceOrientationDidChangeNotification 的观察者。我的函数 screenRotated() 有以下代码:
let interfaceOrientation: UIDeviceOrientation = UIDevice.currentDevice().orientation
if UIDeviceOrientationIsLandscape(interfaceOrientation) {
//does some stuff and then sets self.view = landscapeView
} else {
//does some stuff and then sets self.view = portraitView
}
如何防止我的应用在横向时进入错误的视图?
【问题讨论】:
标签: ios swift ipad uideviceorientation