我猜测应用代理需要进行更改吗?谢谢你的帮助!
答案 0 :(得分:14)
1)通过xcode创建样本Master / Detail
2)在故事板上拖动TabBarController
3)将TabBarController
更改为初始视图控制器。
4)控制从TabBarController
拖动到SplitViewController
5)为故事板中的SplitViewController
分配标题
6)在app delegate中,将SplitViewController
的引用替换为如下。
let tabBarViewController = self.window!.rootViewController as! UITabBarController
print(tabBarViewController.viewControllers?.count)
var splitViewController:UISplitViewController? = nil
for viewController in tabBarViewController.viewControllers! {
if viewController.title == "Master" {
splitViewController = viewController as? UISplitViewController
}
}
let navigationController = splitViewController!.viewControllers[splitViewController!.viewControllers.count-1] as! UINavigationController
navigationController.topViewController!.navigationItem.leftBarButtonItem = splitViewController!.displayModeButtonItem()
splitViewController!.delegate = self