无法lockingiPad Air 2的方向
我正在处理的iOS应用程序有一个视图,需要在横向方向上locking。 到目前为止,这是通过使用shouldAutorotate
和supportedInterfaceOrientations
方法完成的,但是在运行iOS9 beta5
的iPad 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
方法shouldAutorotate
, preferredInterfaceOrientation
和supportedInterfaceOrientations
。
至于locking方向和支持多任务,我还没有find一个方法来做到这一点。
可以从目标设置的“常规”中启用“需要全屏”设置。
启用此function后,方向代码将会运行。 正如ackerman91所提到的,您还可以在应用程序info.plist或目标“Info”选项卡中将UIRequiresFullScreen
布尔值设置为YES。
我认为这是多任务function的附带损害。 你将不能再假设你拥有整个屏幕。 可能有其他方法调用禁止多任务模式。