首页 > 其他 > 详细

修改UITabBarItem的字体颜色

时间:2015-01-08 15:23:55      阅读:510      评论:0      收藏:0      [点我收藏+]

修改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的字体颜色

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!