ios 标签栏项目色调颜色

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21361101/
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-08-30 23:15:35  来源:igfitidea点击:

Tab bar item tint color

iosios7uitabbarcontroller

提问by Reza Safari

In iOS 7, I been developing an app that uses the UITabBarController and I noticed that the tab bar items stay gray even tho I change the tint color of the tab bar. Is there any way to change the color of non-selected tab bar items?

在 iOS 7 中,我一直在开发一个使用 UITabBarController 的应用程序,我注意到即使我更改了标签栏的色调,标签栏项目仍然保持灰色。有什么办法可以改变未选中的标签栏项目的颜色吗?

采纳答案by Balram Tiwari

To do this:: follow a simple approach..

要做到这一点::遵循一个简单的方法..

  1. Change tintColor as you want

  2. Add a new set of images for unselected items and render them in original mode.

  1. 根据需要更改 tintColor

  2. 为未选择的项目添加一组新图像并以原始模式渲染它们。

For more info, read through this link

有关更多信息,请阅读此链接

回答by Iya

To sets the tint color globally for the app, you need to add below code In app delegate didFinishLaunchingWithOptions: method:

要为应用程序全局设置色调颜色,您需要在应用程序中添加以下代码delegate didFinishLaunchingWithOptions: method

[[UITabBar appearance] setTintColor:[UIColor colorWithRed:13.0/255.0 green:116.0/255.0 blue:128.0/255.0 alpha:1.0]];