Шрифты и цвет шрифта iOS5 TabBar

Я настроил внешний вид TabBar таким образом

UIImage *tabBackground = [[UIImage imageNamed:@"tab-bar-bg.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
[[UITabBar appearance] setBackgroundImage:tabBackground];
[[UITabBar appearance] setSelectionIndicatorImage: [UIImage imageNamed:@"activetab.png"]];

Как определить пользовательские шрифты и выбранные и невыбранные цвета текста?

Спасибо,

Ответы

Ответ 1

[[UITabBarItem appearance] setTitleTextAttributes:
     [NSDictionary dictionaryWithObjectsAndKeys:
      [UIColor blackColor], UITextAttributeTextColor, 
      [UIFont fontWithName:@"font" size:0.0], UITextAttributeFont, 
      nil] 
                                             forState:UIControlStateHighlighted];

Ответ 2

[[UITabBarItem appearance] setTitleTextAttributes:
     [NSDictionary dictionaryWithObjectsAndKeys:
      [UIColor blackColor], UITextAttributeTextColor, 
      [UIFont fontWithName:@"ProximaNova-Semibold" size:0.0], UITextAttributeFont, 
      nil] 
                                             forState:UIControlStateHighlighted];


    [[UITabBarItem appearance] setTitleTextAttributes:
     [NSDictionary dictionaryWithObjectsAndKeys:
      [UIColor grayColor], UITextAttributeTextColor, 
      [UIFont fontWithName:@"ProximaNova-Semibold" size:0.0], UITextAttributeFont, 
      nil] 
                                             forState:UIControlStateNormal];

Ответ 3

Этот ответ работает для меня.

Но я думаю, что большинство людей должны изменить forState:UIControlStateHighlighted до forstate:UIControlStateSelected