修改UITabBarItem下面字体的颜色,如图:
[[UITabBarItem
appearance] setTitleTextAttributes:[NSDictionary
dictionaryWithObjectsAndKeys:[UIColor
blackColor], UITextAttributeTextColor,
nil] forState:UIControlStateNormal];
[[UITabBarItem
appearance] setTitleTextAttributes: [NSDictionary
dictionaryWithObjectsAndKeys:[UIColor
redColor],UITextAttributeTextColor,
nil]forState:UIControlStateSelected];
这个时候会报警告‘UITextAttributeTextColor‘
is deprecated in iOS 7. The iOS 7 key is ‘NSForegroundColorAttributeName
然后替换一下就可以了,不过NSForegroundColorAttributeName最底支持到ios6.0
[[UITabBarItem
appearance] setTitleTextAttributes:[NSDictionary
dictionaryWithObjectsAndKeys:[UIColor
blackColor], NSForegroundColorAttributeName,
nil] forState:UIControlStateNormal];
[[UITabBarItem
appearance] setTitleTextAttributes: [NSDictionary
dictionaryWithObjectsAndKeys:[UIColor
redColor],NSForegroundColorAttributeName,
nil]forState:UIControlStateSelected];