码迷,mamicode.com
首页 > 其他好文 > 详细

修改UITabBarItem的字体颜色

时间:2015-01-08 15:24:54      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:字体   uitabbaritem   

修改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];


修改UITabBarItem的字体颜色

标签:字体   uitabbaritem   

原文地址:http://blog.csdn.net/xiao562994291/article/details/42522765

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!