zoukankan      html  css  js  c++  java
  • UITabBarItem's appearance

    1.我们知道,用tabBarController创建出来默认的tabBar似这个样子滴。。。

    -----------------我是图片分割线--------------------------------

    2.通常通过appearance统一设置,可以一劳永逸,不必在每个控制器设置

    @implementation TTTabBarController
    
    +(void)initialize{
        
    //normal状态的文字属性 NSMutableDictionary
    *attrDic = [[NSMutableDictionary alloc]init]; [attrDic setValue:[UIColor grayColor] forKey:NSForegroundColorAttributeName]; [attrDic setValue:[UIFont systemFontOfSize:10] forKey:NSFontAttributeName];
    //select状态的文字属性 NSMutableDictionary
    *selectedAttrDic = [[NSMutableDictionary alloc]init]; [selectedAttrDic setValue:[UIColor darkGrayColor] forKey:NSForegroundColorAttributeName]; [selectedAttrDic setValue:[UIFont systemFontOfSize:10] forKey:NSFontAttributeName];
    //项目中所有tabBarItem都将是这种文字状态 UITabBarItem
    *item = [UITabBarItem appearance]; [item setTitleTextAttributes:attrDic forState:UIControlStateNormal];//normal状态 [item setTitleTextAttributes:selectedAttrDic forState:UIControlStateSelected];//select状态 }

    效果如下:

  • 相关阅读:
    交叉验证概述
    【Python那些事儿之十】range()和xrange()
    Numpy基础笔记
    matplotlib中使用imshow绘制二维图
    Django+Django-Celery+Celery的整合实战
    Nginx+uWSGI+Django部署web服务器
    uwsgi
    uwsgi 神器问题
    disagrees about version
    协议基础:SMTP:使用Telnet学习SMTP协议
  • 原文地址:https://www.cnblogs.com/yintingting/p/4540326.html
Copyright © 2011-2022 走看看