swift3 设置设备方向支持(supportedInterfaceOrientations)

来源:互联网 发布:浏览器软件下载 编辑:程序博客网 时间:2024/05/29 16:37

1、改变整个app的设备方向支持
这里写图片描述
2、代码改变app不同场景的设备旋转方向支持(可以在不同的viewController中处理对设备方向的不同需求)
ps.supportedInterfaceOrientations只能在根控制器中生效,即在navigationController或者tabbarController中生效

override var supportedInterfaceOrientations: UIInterfaceOrientationMask{        return .portrait    }

设置之后当前的控制器和子控制器都会遵守这个方向
ps.supportedInterfaceOrientations 是能在(tabbarController或者navigationController)中生效

原创粉丝点击