ack*_*n91 15 objective-c orientation ipad ios ios9
我正在处理的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
ack*_*n91 23
多任务可以通过添加关闭UIRequiresFullScreen
字段添加到应用程序与布尔值的info.plist YES
,这将允许定向委托方法shouldAutorotate
,preferredInterfaceOrientation
和supportedInterfaceOrientations
射击.
至于锁定方向和支持多任务处理,我还没有找到办法做到这一点.
可以从目标设置的"常规"启用"需要全屏"设置.
启用此功能后,现在将运行方向代码.如ackerman91所述,您还可以UIRequiresFullScreen
在应用程序info.plist或目标"Info"选项卡中将boolean 设置为YES.
归档时间: |
|
查看次数: |
2289 次 |
最近记录: |