// 标签栏控制器
var tabCtl : UITabBarController = UITabBarController.init()
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
let stuVC:FirstViewController = FirstViewController()
stuVC.navigationItem.title = "**"
stuVC.view.backgroundColor = UIColor.white
let stuNav:UINavigationController = UINavigationController.init(rootViewController: stuVC)
let tongVC = SecondViewController()
tongVC.navigationItem.title = "**"
tongVC.view.backgroundColor = UIColor.white
let tongNav = UINavigationController(rootViewController: tongVC)
let findVC = ThirdViewController()
findVC.navigationItem.title = "**"
findVC.view.backgroundColor = UIColor.white
let findNav = UINavigationController(rootViewController: findVC)
let myVC = MyViewController()
myVC.navigationItem.title = "**"
myVC.view.backgroundColor = UIColor.white
let myNav = UINavigationController(rootViewController: myVC)
// 给导航添加标签栏标签
stuNav.tabBarItem = UITabBarItem.init(title: "**", image: UIImage.init(named: "123"), tag: 100)
lifeNav.tabBarItem = UITabBarItem.init(title: "**", image: UIImage.init(named: "123"), tag: 101)
fineNav.tabBarItem = UITabBarItem.init(title: "**", image: UIImage.init(named: "123"), tag: 102)
meNav.tabBarItem = UITabBarItem.init(title: "**", image: UIImage.init(named: "123"), tag: 103)
self.tabCtl.viewControllers = [stuNav,tongNav,findNav,myNav]
self.window?.rootViewController = self.tabCtl
return true
}
Swift->标签控制器
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
推荐阅读更多精彩内容
- 首先创建三个Swift(HomeViewController.swift,CenterViewController...
- 1.首先介绍导航控制器的导航栏: 从上面两个图可以看出UINavigationBar继承之UIView 也是一个控...
- 一、什么是标签栏控制器?把标签栏控制器(UITabBarController)、标签栏(UITabBar)、导航栏...