@implementation XMGTabBarController
/*
问题:
1.选中按钮的图片被渲染 -> iOS7之后默认tabBar上按钮图片都会被渲染 1.修改图片 2.通过代码 √
2.选中按钮的标题颜色:黑色 标题字体大 -> 对应子控制器的tabBarItem
3.发布按钮显示不出来
*/
// 只会调用一次
+ (void)load
{
// 获取哪个类中UITabBarItem,appearance:只能在控件显示之前设置,才有作用
UITabBarItem *item = [UITabBarItem appearanceWhenContainedIn:self, nil];
// 设置按钮选中标题的颜色:富文本:描述一个文字颜色,字体,阴影,空心,图文混排
// 创建一个描述文本属性的字典
NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
attrs[NSForegroundColorAttributeName] = [UIColor blackColor];
[item setTitleTextAttributes:attrs forState:UIControlStateSelected];
// 设置字体尺寸:只有设置正常状态下,才会有效果
NSMutableDictionary *attrsNor = [NSMutableDictionary dictionary];
attrsNor[NSFontAttributeName] = [UIFont systemFontOfSize:13];
[item setTitleTextAttributes:attrsNor forState:UIControlStateNormal];
}