UITabBarItem image color is grey while original image is white

6 Solutions Collect From Internet About “UITabBarItem image color is grey while original image is white”

In iOS7, if you use IB you can subclass UITabBarController then add this:

+ (void)initialize
{
    //the color for the text for unselected tabs
    [UITabBarItem.appearance setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor redColor]} forState:UIControlStateNormal];

    //the color for selected icon
    [[UITabBar appearance] setSelectedImageTintColor:[UIColor whiteColor]];    
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) {
        for (UITabBarItem *tbi in self.tabBar.items) {
            tbi.image = [tbi.image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        }
    }
}

if you create the items manualy you must set the UIImageRenderingModeAlwaysOriginal on each icon and add the code from initialize.

Set selected and unselected image.

[self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"mehr_icon"] withFinishedUnselectedImage:[UIImage imageNamed:@"mehr_icon"]];

images for UITabBarItems should be alpha channel only !
the opaque part will appear grey (blue if selected) only, though!

take a look at: http://devinsheaven.com/creating-uitabbar-uitoolbar-icons-in-adobe-illustrator/

I had the same problem once, I use images with white and alpha only like this image

I set it with self.tabBarItem.image = [UIImage imageNamed:@"Liste"];

Only Way is to go to IB(interface builder) and select the UITabBarItem in your View Controller and go to “file inspector” scroll down and you will see Global Tint her you can set it to no color or any color that you want it will take effect for the selected image.

as per the following code is concern

setFinishedSelectedImage: withFinishedUnselectedImage:;

this is no longer available in iOS 7 rather we can use

[yourCustomTabBarItem setSelectedImage:---];

but this will also take effect of this Global tint color.

If you are using image assets, just set the field “Render As” of your images (selected and unselected images) to “Original Image” (example)

Then in your xib set “Image” and “Selected Image” fields on your Tab Bar Item
(example)