Tim Lodder
Tim Lodder

Reputation: 49

xCode TabBarItem title and icon color

I can't seem to change the color of the Tabbaritem title and the icon when they're not highlighted. I want the color from the title and icon from grey to another color.

Upvotes: 2

Views: 3121

Answers (2)

Vineesh TP
Vineesh TP

Reputation: 7973

In AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]];
return YES;
}

For Changing text color 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;
}

Upvotes: 2

LuckyStarr
LuckyStarr

Reputation: 1500

iOS v5.0 provides methods to customize tabbaritem; read the documentation at this link.

Upvotes: 0

Related Questions