【发布时间】:2014-09-10 11:52:48
【问题描述】:
我为每个 iOS 设备系列创建了一个包含三个不同故事板的应用。现在我不知道应用启动时如何选择合适的 Storyboard?我正在检查屏幕高度以识别不同的设备:
func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {
// Check Device Family
var bounds: CGRect = UIScreen.mainScreen().bounds
var screenHeight: NSNumber = bounds.size.height
var deviceFamily: String
if screenHeight == 480 {
deviceFamily = "iPhoneOriginal"
// Load Storyboard with name: iPhone4
} else if screenHeight == 568 {
deviceFamily = "iPhone5Higher"
// Load Storyboard with name: iPhone5
} else {
deviceFamily = "iPad"
// Load Storyboard with name: iPad
}
return true
}
有人可以在 Swift 中给我一个可行的解决方案吗?我只找到了 ObjC 的解决方案。
谢谢。
【问题讨论】:
标签: ios storyboard swift