您的位置:首页 > 产品设计 > UI/UE

UITabBarItem改变字体颜色

2015-09-04 16:14 369 查看
UITabBarItem正常状态下的字体颜色

[[UITabBarItem
appearance] setTitleTextAttributes:[NSDictionary
dictionaryWithObjectsAndKeys:[UIColor
colorWithRed:154.0/255
green:254.0/255
blue:158.0/255
alpha:1.0],
NSForegroundColorAttributeName,
nil]
forState:UIControlStateNormal];

加了如上设置之后
controller.tabBar.tintColor =
[UIColor whiteColor];////UITabbarController的tintColor将会对选中时的字体无效

所以还需加上如下设置

UITabBarItem选中状态下的字体颜色

[[UITabBarItem
appearance] setTitleTextAttributes:[NSDictionary
dictionaryWithObjectsAndKeys:[UIColor
whiteColor], NSForegroundColorAttributeName,
nil]
forState:UIControlStateSelected];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: