Car*_*ran 2 orientation swift swift3
我试图锁定我viewController只是纵向方向,而不必依赖于部署信息,但我的以下代码不起作用
override var shouldAutorotate: Bool {
return false
}
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
return UIInterfaceOrientationMask.portrait
}
override var preferredInterfaceOrientationForPresentation: UIInterfaceOrientation {
return UIInterfaceOrientation.portrait
}
override func viewDidLoad() {
super.viewDidLoad()
}
Run Code Online (Sandbox Code Playgroud)
小智 5
你可以在AppDelegate中试试这个.这将锁定所有viewControllers的方向
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
return UIInterfaceOrientationMask(rawValue: UIInterfaceOrientationMask.portrait.rawValue)
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6559 次 |
| 最近记录: |