0
votes

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.

3

3 Answers

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

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

0
votes

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];
0
votes

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];