如何在UITabBar中更改[more]按钮文本颜色?

时间:2012-12-10 15:23:11

标签: objective-c uitabbar uitabbaritem

我按照answer将条形项目文本颜色更改为白色,但我有6个tabbar项目,我无法获得系统按钮[更多]项目并更改文本颜色。

如何将此[更多]按钮文字颜色更改为白色? THX。

look the more button

我的代码:

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

1 个答案:

答案 0 :(得分: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