如何在 iOS 7 或 6 中更改导航栏颜色? [英] How to change navigation bar color in iOS 7 or 6?

查看:18
本文介绍了如何在 iOS 7 或 6 中更改导航栏颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想更改导航栏颜色的颜色,但我不确定是否应该更改色调或背景.我知道 iOS 7 将采用更扁平的设计(即使 建议删除梯度),但我无法解读这两者.即使我设置了背景颜色,它也没有任何作用.

I want to change the color of the navigation bar color, but I'm not sure whether or not I should change the tint or the background. I know iOS 7 is going for a more flat design (even recommending removing gradients), but I am having trouble deciphering the two. Even if I set a background color, it doesn't do anything.

在此图像中,背景设置为绿色,但条形图仍为蓝色:

In this image, the background is set to green, but the bar is still blue:

推荐答案

条形的 tintColor 行为在 iOS 7.0 上发生了变化.它不再影响栏的背景,其行为与添加到 UIView 的 tintColor 属性相同.要为栏的背景着色,请使用 -barTintColor.

The behavior of tintColor for bars has changed on iOS 7.0. It no longer affects the bar's background and behaves as described for the tintColor property added to UIView. To tint the bar's background, please use -barTintColor.

navController.navigationBar.barTintColor = [UIColor navigationColor];

这篇关于如何在 iOS 7 或 6 中更改导航栏颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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