2

I follow this answer change the bar items text color to white,but I have 6 tabbar items,I can't get the system button [more] item and change the text color.

How to change this [more] button text color to white? thx.

look the more button

my code:

for (UITabBarItem* item in self.tabBar.items)
{
    NSLog(@"title:%@",item.title); // only get my items
    [item setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                  [UIFont fontWithName:@"AmericanTypewriter" size:11.0f], UITextAttributeFont,
                                  [UIColor whiteColor], UITextAttributeTextColor,
                                  [UIColor clearColor], UITextAttributeTextShadowColor,
                                  [NSValue valueWithUIOffset:UIOffsetMake(0.0f, 1.0f)], UITextAttributeTextShadowOffset,
                                  nil] forState:UIControlStateNormal];
}
Community
  • 1
  • 1
yellow
  • 702
  • 1
  • 10
  • 24

1 Answers1

2

have you tried this , it's work for me :

[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                             [UIFont fontWithName:@"AmericanTypewriter" size:20.0f], UITextAttributeFont,
                                             [UIColor yellowColor], UITextAttributeTextColor,
                                             [UIColor redColor], UITextAttributeTextShadowColor,
                                             [NSValue valueWithUIOffset:UIOffsetMake(0.0f, 1.0f)], UITextAttributeTextShadowOffset,
                                             nil] forState:UIControlStateNormal];

Or replace self.myTabBar with [UITabBarItem appearance]

Mohammad Rabi
  • 1,412
  • 2
  • 21
  • 41
  • nice person,BTW,i have another question about this,How to change the icons color to white? now tabbar tint color is blue,but i want a different color for the image icon.is tabbar can make it? – yellow Dec 10 '12 at 15:57