[英]Manage Device Orientation - IOS
I'm really new to IOS develop and before ask this question I already tried literally all the answer on stackoverflow but couldn't find anything that work (probably I fail somewhere). 我对IOS开发真的很陌生,在问这个问题之前,我已经尝试了所有关于stackoverflow的答案,但是找不到任何有效的方法(可能我在某个地方失败了)。
I want to Disable the possibility of rotate the device view in all my App and I want to decide in every ControllerView if use portrait or landscape. 我想在所有应用程序中禁用旋转设备视图的可能性, 并且我想在每个ControllerView中决定使用纵向还是横向。
How can I do that with Swift? 我该如何用Swift做到这一点?
you should try this on every ViewController an set it with the possibility to rotate, and what orientation should support. 您应该在每个ViewController上尝试此操作,并对其设置旋转的可能性以及应该支持的方向。
override func shouldAutorotate() -> Bool {
return false
}
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.Portrait
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.