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

查看:87
本文介绍了如何在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:

推荐答案

在iOS 7.0上,条形的tintColor的行为已经改变。它不再影响条形图的背景,并且如添加到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天全站免登陆