原来我们通常这样设置导航栏、tablebar颜色
NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
attrs[NSFontAttributeName] = [UIFont systemFontOfSize:12];
attrs[NSForegroundColorAttributeName] = [UIColor grayColor];
NSMutableDictionary *selAttrs = [NSMutableDictionary dictionary];
selAttrs[NSFontAttributeName] = attrs[NSFontAttributeName];
selAttrs[NSForegroundColorAttributeName] = [UIColor lightGrayColor];
UITabBarItem *item = [UITabBarItem appearance];
[item setTitleTextAttributes:attrs forState:UIControlStateNormal];
[item setTitleTextAttributes:selAttrs forState: UIControlStateDisabled];
但是发现
[item setTitleTextAttributes:sforState:UIControlStateDisabled];
毫无作用,就跟不存在一样,而
[item setTitleTextAttributes: forState:UIControlStateNormal];
却是好用的··但是永远失去了不可用状态的颜色效果
最后经过研究,发现解决方法不再是设置
[item appearance];
而是设置
[UITabBar appearance];
[UINavigationBar appearance];
的TintColor,应该是新版本更改了api。