我希望我的应用程序在iPad上可以在所有方向下工作,在iPhone 6 Plus上支持横向和纵向,而在其他设备上仅支持纵向。
但是在iPhone 6/6s Plus上它无法正确工作。旋转很奇怪,视图控制器经常以错误的方向呈现。
以下是我目前在
但是在iPhone 6/6s Plus上它无法正确工作。旋转很奇怪,视图控制器经常以错误的方向呈现。
以下是我目前在
AppDelegate.swift
中的内容:func application(application: UIApplication, supportedInterfaceOrientationsForWindow window: UIWindow?) -> UIInterfaceOrientationMask {
let height = window?.bounds.height
if height > 736.0 {
// iPad
return .All
} else if height == 736.0 {
// 5.5" iPhones
return .AllButUpsideDown
} else {
// 4.7", 4", 3.5" iPhones
return .Portrait
}
}
这该怎么正确地做呢?