UINavigationBar色调颜色与IOS中其余应用程序之间的颜色差异 [英] Color difference between UINavigationBar Tint Color and rest of app in IOS

查看:161
本文介绍了UINavigationBar色调颜色与IOS中其余应用程序之间的颜色差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在Sketch中的设计:

This is my design in Sketch:

Sketch表示蓝色为70,164,239.

Sketch says that the blue color is 70,164,239.

因此,我的标签有以下代码:

So I have the following code for my tab:

UINavigationBar.appearance().barTintColor = UIColor(red: 70.0/255.0, green: 164.0/255.0, blue: 239.0/255.0, alpha: 1.0)
UINavigationBar.appearance().tintColor = UIColor.clearColor()
UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.whiteColor()]

以下内容(操作内)的视图如下:

And the following for the view underneath (inside an action):

self.two_buttons_view.backgroundColor = UIColor(red: 70.0/255.0, green: 164.0/255.0, blue: 239.0/255.0, alpha: 1.0)

但是看看发生了什么,导航栏的颜色总是比视图的颜色浅.浅蓝色只有一点点区别,但是如果我选择深蓝色,它会变得更加引人注目.导航栏的颜色似乎从未像其他页面视图那样丰富:

But look what's going on, the Navigation Bar color is always a little lighter than the color of the view. With this light blue there's only a slight difference but if I go with a darker blue it gets much more noticeable. It appears that the navigation bar's colors are never as rich as the rest of pages views are:

推荐答案

tintColor tint 颜色.它与条形图的半透明性(是一个字?)结合在一起,以及条形图后面的内容,从而提供了其他所得的颜色.

The tintColor is a tint color. It combines with the translucency (is that a word?) of the bar, along with what's behind the bar, to give some other resulting color.

如果您要完全控制导航栏的 actual 颜色,请将其translucent设置为false,然后为其提供背景图片,该背景图片由所需颜色的矩形-和 no 着色颜色.

If you want full control over the actual color of a navigation bar, set its translucent to false and then give it a background image consisting of a rectangle of the desired color - and no tint color.

这篇关于UINavigationBar色调颜色与IOS中其余应用程序之间的颜色差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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