m1234 m1234 - 11 months ago 58
Swift Question

Changing one navigation bar to transparent changes all navigation bars to transparent Swift

I have a navigation controller embedded to the first view of my app, When I change the navigation bar to transparent on one view It changes it to transparent to all views and I cannot seem to change it back. I would like it to be transparent for a few of my Views but not all.

To set to transparent I use:

self.navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
self.navigationController?.navigationBar.shadowImage = UIImage()
self.navigationController?.navigationBar.translucent = true


Put the code that changes the Navigation Bar's background colour in viewWillAppear, and then change the colour back to default in viewWillDisappear