自定义标签栏图标颜色 [英] Custom tab bar icon colors

查看:96
本文介绍了自定义标签栏图标颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用Xcode 5开发面向列表的应用.我在选项卡栏上有自定义色调,在选项卡图标上有自定义图像,在选择选项卡栏时具有自定义色调,但是当找不到图标时,我找不到如何自定义图标图像的色调.现在,它只是默认的灰色,与我的绿色标签栏相比,您几乎看不到它.我想将标签栏图标的图像和名称设置为白色.

Im currently using Xcode 5 to develop a list oriented app. I have a custom tint for the tab bar, custom images for the tab icons, custom tint for the tab bar's icon images when its selected, but i cannot find how to customize the icon images' tint for when its not selected. Right now its just the default gray which you can barely see in contrast to my green tab bar. I want to make the tab bar icons' images and names white.

有人知道如何在Xcode 5中设置标签栏图标的图像色调吗?

Does anybody know how to set the tab bar icons' image tint in Xcode 5?

推荐答案

您可以尝试使用此方法为选定的图标着色:

You can try this to tint selected icon :

// Custom the tab bar
[[UITabBar appearance] setSelectedImageTintColor:[UIColor whiteColor]];

并用它来着色非活动图标:

and this to tint the non active icon :

[self.tabBarItem setFinishedSelectedImage:[UIImage imageNamed:@"item_seleted.png"] withFinishedUnselectedImage:[UIImage imageNamed:@"item_unselected.png"]];

这篇关于自定义标签栏图标颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆