我正在处理的iOS应用程序有一个需要以横向方向锁定的视图.到目前为止,这是通过使用shouldAutorotate和supportedInterfaceOrientations方法完成的,但在iPad Air 2运行时iOS9 beta5,这些方法永远不会触发,方向也不会被锁定.
我尝试了以下设备,除Air2之外的所有方法(使用Xcode beta6运行调试):iPhone 6 +,iPad Mini,iPad Air 2,iPad 2,iPad 3
未开火的方法如下:
- (BOOL)shouldAutorotate {
return YES;
}
- (UIInterfaceOrientationMask)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskLandscape;
}
- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
return UIInterfaceOrientationMaskLandscapeRight;
}
Run Code Online (Sandbox Code Playgroud)
通过显示视图控制器 presentViewController