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:] forKey:NSFontAttributeName];

//select状态的文字属性
NSMutableDictionary *selectedAttrDic = [[NSMutableDictionary alloc]init];
[selectedAttrDic setValue:[UIColor darkGrayColor] forKey:NSForegroundColorAttributeName];
[selectedAttrDic setValue:[UIFont systemFontOfSize:] forKey:NSFontAttributeName];

//项目中所有tabBarItem都将是这种文字状态
UITabBarItem *item = [UITabBarItem appearance];
[item setTitleTextAttributes:attrDic forState:UIControlStateNormal];//normal状态
[item setTitleTextAttributes:selectedAttrDic forState:UIControlStateSelected];//select状态
}

效果如下:

UITabBarItem's appearance的更多相关文章

  1. iOS 开发 中级:UIToolbar,UINavigationBar,UITabBar,UIBarButtonItem,UITabBarItem自定义方法总结

    原文:  http://blog.csdn.net/songrotek/article/details/8692866?utm_source=tuicool 对于UIToolbar,UINavigat ...

  2. iOS项目——基本框架搭建

    项目开发过程中,在完成iOS项目——项目开发环境搭建之后,我们首先需要考虑的就是我们的项目的整体框架与导航架构设计,然后在这个基础上考虑功能模块的完成. 一 导航架构设计 一款App的导航架构设计应该 ...

  3. tabbar选中按钮的标题颜色和字体

    @implementation XMGTabBarController /* 问题: 1.选中按钮的图片被渲染 -> iOS7之后默认tabBar上按钮图片都会被渲染 1.修改图片 2.通过代码 ...

  4. UITabBarController 、TabBar背景颜色设置,UITabBarItem的文字样式(颜色和大小)UITabBarItem的位置调整

    改变UITabBarController的颜色 UIView*mView=[[UIView alloc]initWithFrame:CGRectMake(0,0,320,48)];//这是部分tabb ...

  5. iOS开发--一些UITabBarItem属性的设置[转]

    1.改变UITabBarItem 字体颜色 [[UITabBarItemappearance]setTitleTextAttributes:[NSDictionary dictionaryWithOb ...

  6. IOS 杂笔-13(appearance的巧妙使用)

    在我们查看原生api时,我们不难发现,有些api的后面有着->UI_APPEARANCE_SELECTOR 那么我可以很高兴的说我们可以通过appearance对象来统一设置.十分巧妙. 例如: ...

  7. iOS不得姐项目--appearance的妙用,再一次设置导航栏返回按钮,导航栏左右按钮的封装(巧用分类)

    一.UI_APPEARANCE_SELECTOR 彩票项目中appearance的用法一直没有搞明白,这次通过第二个项目中老师的讲解,更深一层次的了解到了很多关于appearance的作用以及使用方法 ...

  8. [转]设置控件全局显示样式appearance proxy

    转自:huifeidexin_1的专栏 appearance是apple在iOS5.0上加的一个协议,它让程序员可以很轻松地改变某控件的全局样式(背景) @selector(appearance) 支 ...

  9. 利用UI_APPEARANCE统一设置UITabBarItem样式

    -(void)setupTabBarItemAttributes{ //attributes NSMutableDictionary *selectedAttrs= [NSMutableDiction ...

随机推荐

  1. Binary Trees

    1. Definiation What is Binary Trees? Collection of node (n>=0) and in which no node can have more ...

  2. boost 编译依赖库

    正则表达式 icu-devel python python-devel bzip2-devel ./b2 variant=release link=shared threading=multi run ...

  3. java.net.NoRouteToHostException: No route to host

    报错信息: java.net.NoRouteToHostException: No route to host        at java.net.PlainSocketImpl.socketCon ...

  4. 基于多线程多用户的FTP服务器与客户端功能实现

    项目介绍: 用户加密认证 允许同时多用户登录 每个用户有自己的家目录 ,且只能访问自己的家目录 对用户进行磁盘配额,每个用户的可用空间不同 允许用户在ftp server上随意切换目录 允许用户查看当 ...

  5. PDO对象

    <?php //造DSN:驱动名:dbname=数据库名;host=服务器地址 $dsn = "mysql:dbname=mydb;host=localhost"; //造P ...

  6. kali linux 更新软件源,安装中文输入法,修复Linux与windows引导菜单解决windows引导丢失

    1. 更新软件源打开sources.list文件,进行添加更新源:leafpad /etc/apt/sources.list 2. 添加软件源#官方源 deb http://http.kali.org ...

  7. 2.Add Two Numbers-两个单链表相加

    You are given two linked lists representing two non-negative numbers. The digits are stored in rever ...

  8. C# List 扩展排序

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Comm ...

  9. HDU 5795 A Simple Nim

    打表找SG函数规律. #pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> ...

  10. NGUI插件的一个扩展---NGUI_HUD_Text

    NGUI_HUD_Text扩展主要用于主角跟随和伤害/治疗的功能. 场景大概是这样的,我们希望有一个主角,在其头顶显示他的名字,在单击鼠标左键的时候显示红色的“-10”表示减少血量,单击鼠标右键的时候 ...