自定义 UITabBar 未选中项的颜色 [英] Custom UITabBar unselected item's color

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

问题描述

我正在尝试更改未选择的 UITabBarItems 的默认灰色.我已设法更改文本但未更改图像.

I am trying to change the default grey colour of the unselected UITabBarItems. I have managed to change the text but not the image.

TabBar.appearance().barTintColor = UIColor(red: 86.0/255.0, green: 132.0/255.0, blue: 208.0/255.0, alpha: 1.0)

var normalTint: UIColor = UIColor.whiteColor()

TabBar.appearance().tintColor = UIColor.whiteColor()

UITabBarItem.appearance().setTitleTextAttributes([NSForegroundColorAttributeName: normalTint,NSFontAttributeName: UIFont(name: "Arial", size: 13)!], forState: UIControlState.Normal)

推荐答案

你可以使用 .AlwaysOriginal

tabBarItem.selectedImage = UIImage(named: "first-selected")!.imageWithRenderingMode(.AlwaysOriginal)

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

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