[英]How can i set root viewController of NavigationController
i am using TabBar in my application i want to set viewController on tab clicked. 我在应用程序中使用TabBar,我想在单击的选项卡上设置viewController。 My tabs rootviewcontroller is NavigationController.i want to change root viewController of that tab's navigation controller eachTime new on tab select.
我的选项卡rootviewcontroller是NavigationController。我想每次在选项卡选择上更改该选项卡的导航控制器的root viewController。
let nav = UINavigationController(rootViewController: homeViewController)
appdelegate.window!.rootViewController = nav
I think this is what you are looking for: 我认为这是您要寻找的:
let nav1 = UINavigationController(rootViewController: UIViewController())
let nav2 = UINavigationController(rootViewController: UIViewController())
let tab = UITabBarController()
tab.viewControllers = [nav1, nav2]
appdelegate.window!.rootViewController = tab
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.