美文网首页
Swift->标签控制器

Swift->标签控制器

作者: Wang99 | 来源:发表于2017-11-23 08:32 被阅读0次
    // 标签栏控制器
    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->标签控制器

          本文链接:https://www.haomeiwen.com/subject/momavxtx.html