// 标签栏控制器
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
}
网友评论