美文网首页iOS项目实践中的学习
UITabBarItem设置的title细节注意

UITabBarItem设置的title细节注意

作者: coderhlt | 来源:发表于2018-08-16 11:42 被阅读34次
        func addChildViewContoller(title:String,image:String,selectimage:String, vc:UIViewController)  {
            vc.tabBarItem.title=title//设置tabBarItem标签文字
            vc.tabBarItem.image=UIImage(named: image)//设置tabBarItem标签图片
            addChildViewController(vc)
        }
    
      func addChildViewContoller(title:String,image:String,selectimage:String, vc:UIViewController)  {
          vc.navigationItem.title=title//设置了导航条标题
          let na = UINavigationController(rootViewController: vc)
          na.tabBarItem.title=title//设置了tabBarItem标题
          addChildViewController(na)
      }
    
        func addChildViewContoller(title:String,image:String,selectimage:String, vc:UIViewController)  {
            vc.title=title//同时设置了导航条标题,tabarbuttom标题
            let na = UINavigationController(rootViewController: vc)
            addChildViewController(na)
        }
    
        func addChildViewContoller(title:String,image:String,selectimage:String, vc:UIViewController)  {
            vc.tabBarItem.title=title//设置tabarbuttom标题,只有tabBarItem的image有值时,title才会显示。否则好像无限,亲测有效
            vc.tabBarItem.image=UIImage(named: image)
            let na = UINavigationController(rootViewController: vc)
            addChildViewController(na)
        }
    
    

    相关文章

      网友评论

        本文标题:UITabBarItem设置的title细节注意

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