UISplitviewController Master中的iOS8 TabbarController [英] iOS8 TabbarController inside a UISplitviewController Master
问题描述
我试图通过在MasterView的UINavigationController前面添加一个UITabbarController来扩展默认的Apple MasterDetail模板,所以有这样的结构:
I've tried to expand the default Apple MasterDetail Template by adding a UITabbarController in front of the UINavigationController of the MasterView, so there is a structure like this:
UISplitViewController(Master)> UITabbarController> UINavigationController> UITableViewController
UISplitViewController (Master) > UITabbarController > UINavigationController > UITableViewController
但如果我在更改应用程序后运行App (didFinishLaunchingWithOptions)使用正确的ViewController,并尝试执行ShowDetails Segue DetailsView ist在iPhone上呈现Modally。另一方面,iPad版本按预期工作。
我忘了做什么?或者我该如何解决?
But if I run the App, after changing application(didFinishLaunchingWithOptions) to use the correct ViewController, and try to perform the ShowDetails Segue the DetailsView ist presented Modally on the iPhone. On the other side the iPad Version is working as expected. What am I forgot to do? Or how can I fix it?
推荐答案
只是为了更新上面的答案。由于你不能再推动导航控制器,你必须改为推动它的顶视图控制器。
Just to update the answers above. Since you can't push navigation controllers anymore, you have to push its top view controller instead.
func splitViewController(splitViewController: UISplitViewController, showDetailViewController vc: UIViewController, sender: AnyObject?) -> Bool {
if splitViewController.collapsed {
let tabBarController = splitViewController.viewControllers.first as! UITabBarController
let selectedNavigationViewController = tabBarController.selectedViewController as! UINavigationController
// Push view controller
var viewControllerToPush = vc
if let navController = vc as? UINavigationController {
viewControllerToPush = navController.topViewController
}
selectedNavigationViewController.pushViewController(viewControllerToPush, animated: true)
return true
}
return false
}
这篇关于UISplitviewController Master中的iOS8 TabbarController的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!