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.
Asked
Active
Viewed 1,034 times
3 Answers
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
-
What place should i write it? – Walter West Nov 20 '14 at 13:17
-
Where you setup your TabBarController, after instantiating it. – Alin Nov 20 '14 at 16:04
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];

Varsha Vijayvargiya
- 751
- 5
- 13