xcode 更改颜色标签栏图标 iOS 5

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7820388/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 22:10:41  来源:igfitidea点击:

change color tabbar icons iOS 5

xcodeios5uitabbar

提问by Alex van Rijs

I am able to restyle the UITabBar with the following commands

我可以使用以下命令重新设置 UITabBar 的样式

[[UITabBar appearance] setSelectionIndicatorImage:
 [UIImage imageNamed:@"tab_select_indicator"]];
[[UITabBar appearance] setSelectedImageTintColor:[UIColor redColor]];

But how can I set the imageTintColor when the tab isn't selected. The default color is grey and I want to change this to blue.

但是如何在未选择选项卡时设置 imageTintColor。默认颜色为灰色,我想将其更改为蓝色。

Thanks

谢谢

回答by Chrizzz

From the Apple docs UITabBar Class Reference:

来自 Apple 文档 UITabBar 类参考:

If you want to also customize the unselected image appearance, you must sent setFinishedSelectedImage:withFinishedUnselectedImage: to individual tab bar items.

如果您还想自定义未选择的图像外观,则必须将 setFinishedSelectedImage:withFinishedUnselectedImage: 发送到各个选项卡栏项。

回答by Vineesh TP

In AppDlegate.m

在 AppDlegate.m 中

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