我可以为所有其他标签设置已完成的已选择和未选择的图像,但不能为特殊的“更多”项目设置。
screenshot http://f.cl.ly/items/3J2Z0U1g0p343e27250z/Screen%20Shot%202013-10-23%20at%2013.34.54.png
我该怎么做?
以下是当前代码:
[[UITabBar appearance] setTintColor:contrastColor];
[[UITabBarItem appearance] setTitleTextAttributes:@{UITextAttributeTextColor: contrastColor, UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, 0)]} forState:UIControlStateSelected];
[[UITabBarItem appearance] setTitleTextAttributes:@{UITextAttributeTextColor: contrastColor, UITextAttributeTextShadowOffset: [NSValue valueWithUIOffset:UIOffsetMake(0, 0)]} forState:UIControlStateNormal];
contrastColor
是白色的,是从我们的后端系统发送的。
答案 0 :(得分:1)
我不知道这是否适合您,但您可以尝试找到类似于您正在使用的“更多”图像,而不是使用Apple,我假设您正在使用;如果不是只是不理我。
然后就这样做:
UITabBarItem *tabBarItem4 = [[tabViewController.tabBar items] objectAtIndex:3];
[tabBarItem4 setFinishedSelectedImage:[UIImage imageNamed:@"tabbar-more-selected"] withFinishedUnselectedImage:[UIImage imageNamed:@"tabbar-more-normal"]];
答案 1 :(得分:0)
你试过这个吗?
tabBarController.tabBar.barTintColor = yourBarColor;
tabBarController.tabBar.tintColor = yourSelectedIconAndTextColor;
对于不同的州:
[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName:[UIFont fontWithName:yourFontName size:yourFontSize], NSForegroundColorAttributeName: yourSelectedIconAndTextColor} forState:UIControlStateSelected];
[[UITabBarItem appearance] setTitleTextAttributes:@{NSFontAttributeName : [UIFont fontWithName:yourFontName size:yourFontSize], NSForegroundColorAttributeName:[UIColor defaultColor]} forState:UIControlStateNormal];
希望它有所帮助!