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];
}
4

1 回答 1

2

你试过这个吗,它对我有用:

[[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];

或者用 [UITabBarItem 外观] 替换 self.myTabBar

于 2012-12-10T15:36:39.173 回答