swift UITabBarController 嵌套 UINavigationController
Posted 时光不染
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了swift UITabBarController 嵌套 UINavigationController相关的知识,希望对你有一定的参考价值。
//大致相当于 tabar管理3个navigation.
tabBarCtrl = UITabBarController()
let viewHome = ViewHome()
viewHome.tabBarItem.image = UIImage(systemName: "house")
viewHome.tabBarItem.title = "组件"
let viewIcon = ViewIcon()
viewIcon.tabBarItem.image = UIImage(systemName: "photo.on.rectangle")
viewIcon.tabBarItem.title = "图标"
let viewSetting = ViewSetting()
viewSetting.tabBarItem.image = UIImage(systemName: "gearshape")
viewSetting.tabBarItem.title = "设置"
let view1 = UINavigationController.init(rootViewController: viewHome)
let view2 = UINavigationController.init(rootViewController: viewIcon)
let view3 = UINavigationController.init(rootViewController: viewSetting)
tabBarCtrl.addChild(view1)
tabBarCtrl.addChild(view2)
tabBarCtrl.addChild(view3)
tabBarCtrl.selectedIndex = 0
self.window?.rootViewController = tabBarCtrl
window?.makeKeyAndVisible()
以上是关于swift UITabBarController 嵌套 UINavigationController的主要内容,如果未能解决你的问题,请参考以下文章
swift UITabBarController 嵌套 UINavigationController
swift UITabBarController 嵌套 UINavigationController
如何使用 Swift 从 UITabBarController 的子类触发动作
如何在 Swift 中制作简单的 UITabBarController?