美文网首页
Swift tabBarItem设置selectedImage只

Swift tabBarItem设置selectedImage只

作者: 嘿_小小小 | 来源:发表于2017-08-01 19:15 被阅读11次
    • 可以这样设置
    let personalVC = PersonalCenterVC.init(nibName: "PersonalCenterVC", bundle: nil);
    personalVC.tabBarItem.selectedImage = UIImage.init(named: "icon_grzx_xy@2x.png")?.withRenderingMode(.alwaysOriginal);
    //后面加上withRenderingMode(.alwaysOriginal);
    
    • 修改tabBarItem 选中字体颜色
     UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName:UIColor.init(colorLiteralRed: 119 / 255, green: 142 / 255, blue: 242 / 255 , alpha: 1)], for: .selected);
    

    相关文章

      网友评论

          本文标题:Swift tabBarItem设置selectedImage只

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