简体   繁体   English

导航栏的.isTranslucent颜色与rgb等价的颜色是什么?

[英]What are the rgb equivalent colors to the navigation bar's .isTranslucent color?

在此输入图像描述

The navigation bar has a .isTranslucent property that gives it that gray background color 导航栏具有.isTranslucent属性,使其具有灰色背景色

navigationController?.navigationBar.isTranslucent = true

I want my entire view controller to match that same exact color and .lightGray isn't it. 我希望我的整个视图控制器都匹配相同的确切颜色, .lightGray不是.lightGray I tried playing with the view controller's view's .alpha and .isOpaque properties but I cannot get it to match. 我试着用视图控制器的视图的玩.alpha.isOpaque属性,但我不能让它匹配。

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? 有谁知道rgb颜色,或者我可以通过其他方式获取视图控制器的视图的背景颜色来匹配相同的半透明灰色?

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()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM