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

二次信任 提交于 2019-12-11 17:19:31

问题


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

navigationController?.navigationBar.isTranslucent = true

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.

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
} 

回答1:


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


来源:https://stackoverflow.com/questions/55079945/what-are-the-rgb-equivalent-colors-to-the-navigation-bars-istranslucent-color

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!