博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
tabBar选择不同item设置标题不同颜色
阅读量:4552 次
发布时间:2019-06-08

本文共 759 字,大约阅读时间需要 2 分钟。

   

在开发中常常遇到带tabBar的应用,这些应用一般都是只有一个选中颜色,但在开发中也会遇到选择不同item选中颜色不一致的情况,这时要如何解决呢?

方法一:不设置item title 全让UI切成图片,这时只要我们设置不同的图片即可。
方法二:再点击item的代理方法中设置不同的tintcolor。

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{        // 修改tintcolor    if (tabBarController.selectedIndex == 0) {        tabBarController.tabBar.tintColor = RGB(69,171,255);    } else if (tabBarController.selectedIndex == 1) {        tabBarController.tabBar.tintColor = RGB(171,96,203);    } else if (tabBarController.selectedIndex == 2) {        tabBarController.tabBar.tintColor = RGB(252,114,177);    } else {        tabBarController.tabBar.tintColor = RGB(255,218,0);    }}

 

转载于:https://www.cnblogs.com/weicyNo-1/p/7650581.html

你可能感兴趣的文章
WIFI密码破解全攻略
查看>>
c++string各种函数
查看>>
errno.h含义
查看>>
字典树(模型体)
查看>>
盒模型详解
查看>>
bzoj2157 旅游
查看>>
bzoj5016 [Snoi2017]一个简单的询问
查看>>
poj2417 bzoj3239 Discrete Logging(bsgs)
查看>>
UVa10054 - The Necklace(欧拉回路【输出带来的麻烦)
查看>>
string和stringbuffer的区别 集合的作用 ArrayList vector linklist hashmap hashtable collection和collections...
查看>>
6月27日 ajax
查看>>
iOS开发之画图板(贝塞尔曲线)
查看>>
4嵌入式作业io
查看>>
IntelliJ Idea编译报错:javacTask: 源发行版 1.7 需要目标发行版 1.7
查看>>
Cognos中新建SQLserver数据源的步骤
查看>>
HttpClient连接超时及读取超时
查看>>
SQL优化方法
查看>>
SEO必须掌握的高级搜索指令
查看>>
生产者消费者模型
查看>>
ORACLE 字符串超长问题解决方案
查看>>