我的应用程序有一个标签栏,如下所示:
Tab Bar 必须是绿色的,正如您所看到的,Tab Bar 中项目的图标有点难看。如何更改此选项卡栏中图标的颜色?我必须使用标准的标签栏。 谢谢
最佳答案
试试这个
[[self tabBar] setSelectedImageTintColor:[UIColor greenColor]];
或者这个
[UITabBarItem.appearance setTitleTextAttributes:@{
UITextAttributeTextColor : [UIColor greenColor] } forState:UIControlStateNormal];
[UITabBarItem.appearance setTitleTextAttributes:@{
UITextAttributeTextColor : [UIColor purpleColor] } forState:UIControlStateSelected];
或者这个
[[self tabBar] setTintColor:[UIColor redColor]];
或者这个
[UITabBarItem.appearance setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor greenColor]} forState:UIControlStateNormal];
[UITabBarItem.appearance setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor purpleColor]} forState:UIControlStateSelected];
关于ios - 在 UITabBar iOS 中更改项目颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28294564/