// 默认
NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
attrs[NSFontAttributeName] = [UIFont systemFontOfSize:12];
attrs[NSForegroundColorAttributeName] = [UIColor grayColor];
// 选中
NSMutableDictionary *attrSelected = [NSMutableDictionary dictionary];
attrSelected[NSFontAttributeName] = [UIFont systemFontOfSize:12];
attrSelected[NSForegroundColorAttributeName] = [UIColor darkGrayColor];
UITabBarItem *item = [UITabBarItem appearance];
[item setTitleTextAttributes:attrs forState:UIControlStateNormal];
[item setTitleTextAttributes:attrSelected forState:UIControlStateNormal];
OC - Tabbar的选中文字改变颜色
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- 需要,tabbar顶部无横线,不带模糊和透明度效果,遇到小坑,特此记录,appearance 和 unselect...
- 只需要设置 UITabBarItem 的未选中颜色即可 [[UITabBar appearance] setUns...
- 设置方法 iOS13的问题 无法成功设置tabBar未选中状态下的文字颜色 iOS14的问题 首次进入可成功设置t...