【发布时间】:2018-02-09 00:09:14
【问题描述】:
我正在为我的应用构建横向支持,但我不想支持 iPhone SE 的小屏幕,因为它很难适应横向 UI。
有没有办法只为 iPhone SE 设置纵向,而所有其他 iPhone 型号都支持横向?
我试过这段代码,但对我不起作用。
func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
if UIDevice.current.modelName == "iPhone 4" ||
UIDevice.current.modelName == "iPhone 5" ||
UIDevice.current.modelName == "iPhone 4s" ||
UIDevice.current.modelName == "iPhone 5s" {
return .portrait
} else {
return .all
}
}
谢谢
【问题讨论】:
标签: ios iphone swift xcode device-orientation