设置tabbaritem的title颜色(选中和未选中)
2016-02-22 15:22
495 查看
#define UIColorFromRGB(rgbValue) \
[UIColor colorWithRed:((float)((rgbValue &
0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0x00FF00) >>
8))/255.0 \
blue:((float)((rgbValue & 0x0000FF) >>
0))/255.0 \
alpha:1.0]
//点击之后的颜色:草绿
#define COLOR_HIGHTLIGHT UIColorFromRGB(0x129190)
//白色
#define COLOR_THEME_FONT UIColorFromRGB(0xffffff)
-------------关键代码---------------
NSDictionary *attributes =
[NSDictionary
dictionaryWithObjectsAndKeys:[UIFont
fontWithName:@"Helvetica"
size:10],
NSFontAttributeName,
COLOR_THEME_FONT,
NSForegroundColorAttributeName,
nil];
[[UITabBarItem
appearance] setTitleTextAttributes:attributes
forState:UIControlStateNormal];
NSDictionary *attributes2 =
[NSDictionary
dictionaryWithObjectsAndKeys:[UIFont
fontWithName:@"Helvetica"
size:10],
NSFontAttributeName,
COLOR_HIGHTLIGHT,
NSForegroundColorAttributeName,
nil];
[[UITabBarItem
appearance] setTitleTextAttributes:attributes2
forState:UIControlStateSelected];
[UIColor colorWithRed:((float)((rgbValue &
0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0x00FF00) >>
8))/255.0 \
blue:((float)((rgbValue & 0x0000FF) >>
0))/255.0 \
alpha:1.0]
//点击之后的颜色:草绿
#define COLOR_HIGHTLIGHT UIColorFromRGB(0x129190)
//白色
#define COLOR_THEME_FONT UIColorFromRGB(0xffffff)
-------------关键代码---------------
NSDictionary *attributes =
[NSDictionary
dictionaryWithObjectsAndKeys:[UIFont
fontWithName:@"Helvetica"
size:10],
NSFontAttributeName,
COLOR_THEME_FONT,
NSForegroundColorAttributeName,
nil];
[[UITabBarItem
appearance] setTitleTextAttributes:attributes
forState:UIControlStateNormal];
NSDictionary *attributes2 =
[NSDictionary
dictionaryWithObjectsAndKeys:[UIFont
fontWithName:@"Helvetica"
size:10],
NSFontAttributeName,
COLOR_HIGHTLIGHT,
NSForegroundColorAttributeName,
nil];
[[UITabBarItem
appearance] setTitleTextAttributes:attributes2
forState:UIControlStateSelected];
相关文章推荐
- rman 异机恢复
- 手势
- 函数参数
- Android学习笔记
- Android自动开关机实现
- 计算比特币发行量总额
- android 工具类之--TextUtils
- 关于 hot code replace fail 问题 .
- 闲说HeartBeat心跳包和TCP协议的KeepAlive机制
- iOS 自动化测试
- Node.js、Express框架安装 提示Express不是内部或外部命令
- 系统定义弹窗以及自定义弹窗
- 百度语音sdk授权问题
- full screen video background
- SpringMVC 2.5.6 noMapping
- Android工程师面试题大全
- js常用方法(正则工具类)
- Ubuntu 网站服务器环境搭建
- https安全协议
- Android禁止Menu菜单键长按,(Android菜单形式)