0

I changed tab bar background in Bar Tint field and want to change text colour for tab bar button. By default is grey and blue. I try to change field Tint in section View, but it doesn't help.

Kampai
  • 22,848
  • 21
  • 95
  • 95
Walter West
  • 829
  • 3
  • 12
  • 31

3 Answers3

0
NSDictionary *attribute = @{NSForegroundColorAttributeName:[UIColor redColor]};
[[UITabBarItem appearance] setTitleTextAttributes:attribute forState:UIControlStateNormal];

This will change the text colour for the tab bar button.

gabbler
  • 13,626
  • 4
  • 32
  • 44
0

This is for selected state:

[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor redColor]} forState:UIControlStateSelected];

This is for not selected state:

[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor greenColor]} forState:UIControlStateNormal];
Alin
  • 101
  • 1
  • 9
0

Try it

To change tabbar text color you can use this

 [[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary [UIColor redColor], UITextAttributeTextColor,[UIColor redColor],UITextAttributeTextShadowColor,[NSValue valueWithUIOffset:UIOffsetMake(0, 0.5)], UITextAttributeTextShadowOffset,[UIFont fontWithName:@"Arial" size:10], UITextAttributeFont,nil]forState:UIControlStateNormal];