0

Here's what I've tried:

I've tried the following in the parent view controller:

[self.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                               [UIColor whiteColor], UITextAttributeTextColor,
                                               nil] forState:UIControlStateNormal];

I've tried the following in the application delegate:

[[UITabBarItem appearance] 
 setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                         [UIColor whiteColor], UITextAttributeTextColor,
                         nil]
 forState:UIControlStateNormal];

I've even tried changing UIControlStateNormal to any of the other available constants. The only one that changes anything is UIControlStateHighlighted which changes the color of the highlighted tab. Is this a bug in the API or is there something I'm missing?

Key things to note:

  • I'm using storyboarding
  • I have a UITabBarController where each tab has an embedded UINavigationController (pretty standard setup)
  • I've tried embedding the first code snippet into both the UINavigationController subclass as well as the root UIViewController subclass that is inside the UINavigationController. No luck there either.
Jesse Bunch
  • 6,651
  • 4
  • 36
  • 59
  • what do you want to change the text color to? Doesn't it make the unselected ones dark gray and the highlighted one a white-gray by default? – jacerate Jul 13 '12 at 16:05
  • Yes. I'm wanting to change the unselected grey text to white. – Jesse Bunch Jul 13 '12 at 16:08
  • Unfortunately I believe Apple wants all tab bars to be like that in their human interface guidelines, maybe not that color but the unselected ones have to be a different color than the selected one. So it should be possible and we can continue to find a solution, but if you want to make them all the same regardless of the currently selected one you're S.O.L – jacerate Jul 13 '12 at 16:23
  • I really was not going to make them all white for both states, I just wanted to know how to change it and I was trying white as a sample color. – Jesse Bunch Jul 13 '12 at 16:26
  • check this out: http://stackoverflow.com/questions/10284433/ios5-tabbar-fonts-and-color, let me know if you want me to make it an answer – jacerate Jul 13 '12 at 16:31
  • In my searching prior to posting this question, I tried that one and this one: http://stackoverflow.com/questions/8412010/how-to-change-the-color-of-text-in-uitabbaritem-in-ios-5/8412083#8412083. Niether of them work. – Jesse Bunch Jul 13 '12 at 16:32
  • Are you implementing UITabBarControllerDelegate or UITabBarDelegate in the controller you are trying to change the colors from? – jacerate Jul 13 '12 at 16:36
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/13861/discussion-between-jesse-bunch-and-user1458968) – Jesse Bunch Jul 13 '12 at 16:40

0 Answers0