小编mel*_*ent的帖子

在Swift iOS9中锁定横向方向

我正在努力在横向模式下锁定我的应用程序.我只有一个ViewController,它不在NavigationController中.在视图控制器内部,我有以下代码:

override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
    return UIInterfaceOrientationMask.LandscapeLeft
}
override func shouldAutorotate() -> Bool {
    return false;
}
override func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation {
    return UIInterfaceOrientation.LandscapeLeft
}
Run Code Online (Sandbox Code Playgroud)

在设置的"常规"选项卡中,我有以下内容:

一般

在ViewController的属性中我有这个:

属性

我尝试在ViewDidLoad中使用UIDevice.currentDevice().setValue(...),但这没有任何效果.我试图在iPad mini上运行这个应用程序,我完全不知所措.任何帮助将非常感激.

ios swift

2
推荐指数
1
解决办法
1938
查看次数

标签 统计

ios ×1

swift ×1