1

How to change the unselected tabbaritem color in iOS7? This does not work.

I'm trying this

[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont fontWithName:[ThemeManager customFont] size:10.0f],
                                                    NSForegroundColorAttributeName : [UIColor greenColor]
                                                    } forState:UIControlStateSelected];

Colour changes but not the custom font I'm using.

Community
  • 1
  • 1
user1898829
  • 3,437
  • 6
  • 34
  • 62
  • I've recently been looking into the same thing. In the end I decided it wasn't possible :( – Fogmeister Jul 21 '14 at 09:38
  • I've also run into the same problem. This is my first venture in iOS development and so far its like a magic school bus ride through Steve Jobs' small intestine. – clocksmith Aug 11 '14 at 01:02
  • In iOS development you will find the easy stuff is difficult and the difficult stuff is easy. – user1898829 Aug 11 '14 at 09:29

1 Answers1

1

Found the solution.

[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName: [UIFont fontWithName:[ThemeManager customFont] size:17.0f],
                                                    NSForegroundColorAttributeName: [UIColor greenColor]}
                                         forState:UIControlStateSelected];

[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName: [UIFont fontWithName:[ThemeManager customFont] size:17.0f],
                                                    NSForegroundColorAttributeName: [UIColor blackColor]}
                                         forState:UIControlStateNormal];
Fogmeister
  • 76,236
  • 42
  • 207
  • 306
user1898829
  • 3,437
  • 6
  • 34
  • 62