强制横屏

在新页面的 viewDidLoad 中执行:

        UIDevice.currentDevice().setValue(UIInterfaceOrientation.LandscapeRight.rawValue, forKey: "orientation")


横屏解决方案


将 SecondViewController 中的函数改为:


override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {

return UIInterfaceOrientationMask.All

}

override func preferredInterfaceOrientationForPresentation() -> UIInterfaceOrientation {

return UIInterfaceOrientation.LandscapeLeft

}


你可能感兴趣的:(强制横屏)