在iOS 7上更改标签栏色调颜色 [英] Change tab bar tint color on iOS 7

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

问题描述

有什么方法可以将iOS 7上的标签栏的色调从默认白色(蓝色图标)更改为另一种具有不同颜色按钮的颜色色调?

Is there a way to change the tint of a tab bar on iOS 7 from the default white with blue icons to another color tint with different color buttons?

推荐答案

尝试以下操作:

[[UITabBar appearance] setTintColor:[UIColor redColor]];
[[UITabBar appearance] setBarTintColor:[UIColor yellowColor]];

要调整非活动按钮,请将以下代码放在VC viewDidLoad

To tint the non active buttons, put the below code in your VC's viewDidLoad:

UITabBarItem *tabBarItem = [yourTabBarController.tabBar.items objectAtIndex:0];

UIImage *unselectedImage = [UIImage imageNamed:@"icon-unselected"];
UIImage *selectedImage = [UIImage imageNamed:@"icon-selected"];

[tabBarItem setImage: [unselectedImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
[tabBarItem setSelectedImage: selectedImage];

你需要为所有tabBarItems做这个,是的,我知道这是丑陋的, strong> 会是更清洁的方式。

You need to do this for all the tabBarItems, and yes I know it is ugly and hope there will be cleaner way to do this.

这篇关于在iOS 7上更改标签栏色调颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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