无法lockingiPad Air 2的方向

我正在处理的iOS应用程序有一个视图,需要在横向方向上locking。 到目前为止,这是通过使用shouldAutorotatesupportedInterfaceOrientations方法完成的,但是在运行iOS9 beta5iPad Air 2上,这些方法永远不会触发,方向也不会被locking。

我尝试了以下设备,除了Air2(运行Xcode beta6运行debugging)之外,所有方法都被触发:iPhone 6+,iPad Mini,iPad Air 2,iPad 2,iPad 3

没有触发的方法如下:

 - (BOOL)shouldAutorotate { return YES; } - (UIInterfaceOrientationMask)supportedInterfaceOrientations { return UIInterfaceOrientationMaskLandscape; } - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { return UIInterfaceOrientationMaskLandscapeRight; } 

视图控制器通过presentViewController显示

可以通过将UIRequiresFullScreen字段添加到应用程序的info.plist中并使用布尔值YES来closures多任务处理,这将允许触发方向shouldAutorotate方法shouldAutorotatepreferredInterfaceOrientationsupportedInterfaceOrientations

至于locking方向支持多任务,我还没有find一个方法来做到这一点。

可以从目标设​​置的“常规”中启用“需要全屏”设置。

需要全屏

启用此function后,方向代码将会运行。 正如ackerman91所提到的,您还可以在应用程序info.plist或目标“Info”选项卡中将UIRequiresFullScreen布尔值设置为YES。

我认为这是多任务function的附带损害。 你将不能再假设你拥有整个屏幕。 可能有其他方法调用禁止多任务模式。