在显示弹出窗口时设置标签栏图标的颜色? [英] Setting the tab bar icon color when popup is shown?
本文介绍了在显示弹出窗口时设置标签栏图标的颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经能够根据需要为我的标签栏项设置文本和图标的颜色.白色表示未激活,蓝色表示正在激活.
I was already able to set the text and icon colors for my tab bar items as desired. White for not active, blue for active.
但是,我仍然遇到一个问题: 显示弹出视图或警报视图时,选项卡栏项目图标显示为灰色:
However, I still run into one issue: When a popover or alert view is shown, the tab bar item icon is greyed out:
在这种状态下是否有可能保持蓝色?
Is there any possibility to keep the blue color for this state?
感谢您的帮助.
编辑
很抱歉,我的问题不是重复的.我已经做了所有这些事情:
I'm sorry, but my question is not a duplicate. I already do all these things:
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've written, any popover, alert view, etc. will change the color of my active icon to grey.
推荐答案
self.tabBar.tintAdjustmentMode = UIViewTintAdjustmentModeNormal;
完成工作.
这篇关于在显示弹出窗口时设置标签栏图标的颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文