Customizing tab bar icon color when popup is displayed?
I've already been able to set the text and icon colors for the tab bar items as I see fit. White for inactive, blue for active.
However, I still run into one question: When a popover or alert view is displayed, the tab bar item icon is grayed out:
Is there a way to keep blue for this state?
Thank you for your help.
EDIT
Sorry, but my question is not duplicated. I already do all this:
self.tabBar.tintColor = COLOR_CORPORATE_BLUE;
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor], NSForegroundColorAttributeName,
nil] forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
COLOR_CORPORATE_BLUE, NSForegroundColorAttributeName,
nil] forState:UIControlStateSelected];
NSUInteger i = 0;
NSString *imageName = @"";
for (UITabBarItem *item in self.tabBar.items) {
switch (i) {
case 0: imageName = @"home_tab_db"; break;
case 1: imageName = @"home_tab_al"; break;
case 2: imageName = @"home_tab_ru"; break;
case 3: imageName = @"home_tab_da"; break;
}
UIImage *img = [UIImage imageNamed:imageName];
if ([img respondsToSelector:@selector(imageWithRenderingMode:)]) {
item.image = [img imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
} else {
item.image = img;
}
item.selectedImage = [UIImage imageNamed:[imageName stringByAppendingString:@"_active"]];
i++;
}
However, as I already wrote, any popover, alert view, etc. will change the color of my active icon to gray.
+3
source to share