新建UITabbarcontroller用swift

2018-10-21  本文已影响0人  盖世英雄的梦想

在AppDelegate当中写

let one = oneViewController()
let nav1 = UINavigationController(rootViewController: one)
nav1.tabBarItem = UITabBarItem(title: "呵呵", image: UIImage(named: ""), tag: 1)

    let er = erViewController()
    let nav2 = UINavigationController(rootViewController: er)
    nav2.tabBarItem = UITabBarItem(title: "哈哈", image: UIImage(named: ""), tag: 1)
    
    let tbv = UITabBarController()
    
    tbv.viewControllers = [nav1,nav2]
    
    self.window?.rootViewController = tbv
上一篇下一篇

猜你喜欢

热点阅读