我似乎无法更改Tabbaritem标题的颜色和未突出显示的图标。我希望标题和图标的颜色从灰色变为另一种颜色。
答案 0 :(得分:2)
在AppDelegate.m中
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]];
return YES;
}
用于更改文本颜色viewController.m
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self)
{
[self.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor greenColor],UITextAttributeTextColor,nil] forState:UIControlStateNormal];
}
return self;
}
答案 1 :(得分:0)
iOS v5.0提供了自定义tabbaritem的方法;阅读此link。
的文档