ChenYilong / CYLTabBarController

[EN]It is an iOS UI module library for adding animation to iOS tabbar items and icons with Lottie, and adding a bigger center UITabBar Item. [CN]【中国特色 TabBar】一行代码实现 Lottie 动画TabBar,支持中间带+号的TabBar样式,自带红点角标,支持动态刷新。【iOS13 & Dark Mode & iPhone XS MAX supported】
MIT License
6.91k stars 1.45k forks source link

设置TabBar文字颜色不起作用 #208

Closed zhangjianjun056 closed 5 years ago

zhangjianjun056 commented 6 years ago

你好,请问为何我用代码如下: // 设置tabBarItem 的选中和不选中文字属性 // 普通状态下的文字属性 let normalAttrs = [NSAttributedStringKey(rawValue: "NSForegroundColorAttributeName"):UIColor.black] // 选中状态下的文字属性 let selectedAttrs = [NSAttributedStringKey(rawValue: "NSForegroundColorAttributeName"):UIColor.white] // 设置文字属性 let tabBar = UITabBarItem.appearance() tabBar.setTitleTextAttributes(normalAttrs, for: .normal) tabBar.setTitleTextAttributes(selectedAttrs, for: .selected) 为何设置了之后,TabBar的颜色还是没有变化,请大神帮忙看一下吧,谢谢!

ChenYilong commented 6 years ago

demo中已经演示了如何设置颜色,可以参考demo里的做法。