您的位置:首页 > 移动开发 > Swift

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

2017-05-22 20:10 483 查看
1、改变整个app的设备方向支持



2、代码改变app不同场景的设备旋转方向支持(可以在不同的viewController中处理对设备方向的不同需求)

ps.supportedInterfaceOrientations只能在根控制器中生效,即在navigationController或者tabbarController中生效

override var supportedInterfaceOrientations: UIInterfaceOrientationMask{
return .portrait
}


设置之后当前的控制器和子控制器都会遵守这个方向

ps.supportedInterfaceOrientations 是能在(tabbarController或者navigationController)中生效
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  swift