IOS开发-在UIViewController中锁定竖屏

来源:互联网 发布:曾亮 redux源码 编辑:程序博客网 时间:2024/05/18 03:22

转自:http://www.jianshu.com/p/6ebfc7294e13

因为APP中有视频播放,所以不能全局锁定,只能在一些实在不想横屏的Controller中进行锁定

代码如下:

    override func shouldAutorotate() -> Bool {        return false    }    override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {        return UIInterfaceOrientationMask.Portrait    }    override func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation {        return UIInterfaceOrientation.Portrait    }
0 0
原创粉丝点击