SplitViewController 在使用之前应该在索引 0 处有一个视图控制器吗?
SplitViewController is expected to have a view controller at index 0 before it used?
每次我显示拆分视图控制器时,我都会在控制台中收到此错误。我找不到具体的解决方案?指导?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.makeKeyAndVisible()
let splitViewController = UISplitViewController()
let masterViewController = TabBarMaster(collectionViewLayout: UICollectionViewFlowLayout())
let detailViewController = UINavigationController()
splitViewController.maximumPrimaryColumnWidth = 80
splitViewController.preferredDisplayMode = .AllVisible
splitViewController.delegate = self
splitViewController.viewControllers = [masterViewController, detailViewController]
window?.rootViewController = splitViewController
return true
}
在设置 splitViewController 的任何其他属性之前设置 splitViewController viewControllers 数组:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.makeKeyAndVisible()
let splitViewController = UISplitViewController()
let masterViewController = TabBarMaster(collectionViewLayout: UICollectionViewFlowLayout())
let detailViewController = UINavigationController()
splitViewController.viewControllers = [masterViewController, detailViewController] // move it here
splitViewController.maximumPrimaryColumnWidth = 80
splitViewController.preferredDisplayMode = .AllVisible
splitViewController.delegate = self
window?.rootViewController = splitViewController
return true
}
每次我显示拆分视图控制器时,我都会在控制台中收到此错误。我找不到具体的解决方案?指导?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.makeKeyAndVisible()
let splitViewController = UISplitViewController()
let masterViewController = TabBarMaster(collectionViewLayout: UICollectionViewFlowLayout())
let detailViewController = UINavigationController()
splitViewController.maximumPrimaryColumnWidth = 80
splitViewController.preferredDisplayMode = .AllVisible
splitViewController.delegate = self
splitViewController.viewControllers = [masterViewController, detailViewController]
window?.rootViewController = splitViewController
return true
}
在设置 splitViewController 的任何其他属性之前设置 splitViewController viewControllers 数组:
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window?.makeKeyAndVisible()
let splitViewController = UISplitViewController()
let masterViewController = TabBarMaster(collectionViewLayout: UICollectionViewFlowLayout())
let detailViewController = UINavigationController()
splitViewController.viewControllers = [masterViewController, detailViewController] // move it here
splitViewController.maximumPrimaryColumnWidth = 80
splitViewController.preferredDisplayMode = .AllVisible
splitViewController.delegate = self
window?.rootViewController = splitViewController
return true
}