2
我似乎无法更改Tabbaritem标题和图标的颜色,当它们未被突出显示时。我希望标题和图标的颜色从灰色变为另一种颜色。xCode TabBarItem标题和图标颜色
我似乎无法更改Tabbaritem标题和图标的颜色,当它们未被突出显示时。我希望标题和图标的颜色从灰色变为另一种颜色。xCode TabBarItem标题和图标颜色
iOS v5.0提供了自定义tabbaritem的方法;阅读link的文档。
在AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]];
return YES;
}
为 “Tabbaritem”
- (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;
}
搜索因此更改文本颜色viewController.m - 有很多的答案已经存在。 – Rayfleck