0
votes

enter image description here

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
It's translucent, that means it depends on the background behind the navigation bar.Sulthan

1 Answers

0
votes

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)

cap

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

navigationController?.navigationBar.shadowImage = UIImage()