导航栏的 .isTranslucent 颜色的 rgb 等效颜色是什么? [英] What are the rgb equivalent colors to the navigation bar's .isTranslucent color?

查看:23
本文介绍了导航栏的 .isTranslucent 颜色的 rgb 等效颜色是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

导航栏有一个 .isTranslucent 属性,赋予它灰色背景色

The navigation bar has a .isTranslucent property that gives it that gray background color

navigationController?.navigationBar.isTranslucent = true

我希望我的整个视图控制器与完全相同的颜色匹配,而 .lightGray 不是.我尝试使用视图控制器视图的 .alpha.isOpaque 属性,但无法匹配.

I want my entire view controller to match that same exact color and .lightGray isn't it. I tried playing with the view controller's view's .alpha and .isOpaque properties but I cannot get it to match.

有谁知道 rgb 颜色或其他方法可以让我的视图控制器的视图背景颜色匹配相同的半透明灰色吗?

Does anyone know the rgb colors or another way I can get my view controller's view's background color to match that same translucent gray color?

override func viewDidLoad() {
    super.viewDidLoad()

    // I tried playing with different combinations of all of these in different ways

    view.backgroundColor = .lightGray

    view.alpha = .5

    view.isOpaque = false
} 

推荐答案

这会将视图和导航栏设置为相同的颜色:

This would set the view and navigation bar to the same colour:

view.backgroundColor = UIColor(red   : 249.0/255.0,
                               green : 249.0/255.0,
                               blue  : 249.0/255.0,
                               alpha : 1.0)

接缝仍然存在.如果您想删除它:

The seam would still be there. If you'd like to remove it :

navigationController?.navigationBar.shadowImage = UIImage()

这篇关于导航栏的 .isTranslucent 颜色的 rgb 等效颜色是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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