问题: iPad 和6p 大屏手机启动就横屏
1:在App info.plist文件中设置 Supported interface orientations,为Portrait。(切记一定不要加其它项,否则可能导致横屏启动)
2:在App delegate中添加下面方法。
func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask {
return .All
}
需要横屏的控制器该怎么实现怎么实现另外两个横屏方法就行
override func shouldAutorotate() -> Bool {
print("------------shouldAutorotate")
return false
}
override func prefersStatusBarHidden() -> Bool {
return true
}
override func supportedInterfaceOrientations() -> UIInterfaceOrientationMask {
// print("------------supportedInterfaceOrientations")
return UIInterfaceOrientationMask.Portrait
}