设置tabBarItem字体颜色和图片颜色
2016-07-06 19:16
330 查看
第一种方法:
[self.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor blackColor]} forState:UIControlStateSelected];
第二种方法:
[self.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor redColor],NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];
第三种方法:
self.tabBarController.tabBar.tintColor = [UIColor colorWithRed:255.0/255.0 green:124.0/255.0 blue:56.0/255.0 alpha:1];
设置图片原始颜色
UIImage *image = [self.tabBarItem.selectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
self.tabBarItem.selectedImage = image;
[self.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor blackColor]} forState:UIControlStateSelected];
第二种方法:
[self.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor redColor],NSForegroundColorAttributeName, nil] forState:UIControlStateNormal];
第三种方法:
self.tabBarController.tabBar.tintColor = [UIColor colorWithRed:255.0/255.0 green:124.0/255.0 blue:56.0/255.0 alpha:1];
设置图片原始颜色
UIImage *image = [self.tabBarItem.selectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
self.tabBarItem.selectedImage = image;
相关文章推荐
- 有效的XML: DTD(文档类型定义)介绍
- java并发
- 欢迎使用CSDN-markdown编辑器
- 微信公众帐号开发教程第15篇-自定义菜单的view类型(访问网页)
- 分类算法中的ROC与PR指标
- Web Storage
- Html 字体大小单位 px em pt
- 微信公众帐号开发教程第14篇-自定义菜单的创建及菜单事件响应
- Android 禁用多点触控
- Android之SoundPool音效池的介绍与使用
- jsp中使用Button按钮
- 细说线程函数
- Assemblepoj3497
- 微信公众帐号开发教程第13篇-图文消息全攻略
- 微信公众帐号开发教程第12篇-符号表情的发送(下)
- MyEclipse10安装JBPM3.2.3
- 列表分页小结2
- rsyslog性能表现
- 如何制作安卓项目gif效果图及其简单菜单munu的计算问题
- 创建ovs网桥