swift UITabBarController 嵌套 UINavigationController
程序员文章站
2022-04-01 12:42:28
...
//大致相当于 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()
下一篇: Rectangle and Circle
推荐阅读
-
UITabBarController与UINavigationController混合开发
-
UIViewController、UINavigationController与UITabBarController的整合使用
-
UITabbarController + UINavigationController隐藏tabbar
-
UINavigationController和UITabBarController
-
swift UITabBarController 嵌套 UINavigationController
-
Swift - 使用UITabBarController UINavigationcontroller搭建项目
-
快速改变UINavigationController和UITabBarController相关属相的方法
-
UITabBarController和UINavigationController的自定义
-
UINavigationController和UITabBarController合用。
-
use UINavigationController inside a UITabBarController