1

I have this code in my AppDelegate.m file under didFinishLaunchingWithOptions: so that I can have a custom font.

[[UITabBarItem appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
                                                        [UIColor grayColor], UITextAttributeTextColor,
                                                        [UIFont fontWithName:@"Gotham-Medium" size:10], UITextAttributeFont, nil] forState:UIControlStateNormal];

[[UITabBarItem appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
                                                        [UIColor whiteColor], UITextAttributeTextColor,
                                                        [UIFont fontWithName:@"Gotham-Medium" size:10], UITextAttributeFont, nil] forState:UIControlStateHighlighted];

The font change works as expected, but I get this output in the Debug console:

button text attributes only respected for UIControlStateNormal, UIControlStateHighlighted and UIControlStateDisabled. state = 1 is interpreted as UIControlStateHighlighted.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Cody Winton
  • 2,989
  • 5
  • 25
  • 48

1 Answers1

5

Change UIControlStateHighlighted to UIControlStateSelected

Abdullah Shafique
  • 6,878
  • 8
  • 35
  • 70