Link to home
Start Free TrialLog in
Avatar of john_yourspace
john_yourspace

asked on

UITabBar color

Hi guys,

I am trying to set the selected and unselected color for my UITabBar icons and text,

My code doesn't seem to be working what is the best solution, I have the following in the appdelegate

Note: the only thing thats not working is the unselected state.

UIImage *tabBarBackground = [UIImage imageNamed:@"TabBar.png"];
    
    [[UITabBar appearance] setBackgroundImage:tabBarBackground];
    
    [[UITabBar appearance] setTintColor:[UIColor blackColor]];
    [[UITabBar appearance] setSelectedImageTintColor:[UIColor blackColor]];
    
    
    [[UIView appearanceWhenContainedIn:[UITabBar class], nil] setTintColor:[UIColor redColor]];
    [[UITabBar appearance] setSelectedImageTintColor:[UIColor greenColor]];
    

Open in new window

Avatar of Shahan Ayyub
Shahan Ayyub
Flag of Pakistan image

Did you try TabBar delegate functions ? e.g., didSelectItem ? Change the image for all button and then selected image of the button that tapped ?
Avatar of john_yourspace
john_yourspace

ASKER

Do you have some sample code to try
ASKER CERTIFIED SOLUTION
Avatar of Shahan Ayyub
Shahan Ayyub
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial