berkt berkt - 6 months ago 9
Swift Question

How do I make my navigation bar transparent in swift?

I want to make my navigation controller like this. My main view should continue to the top.
enter image description here

But when I am trying implement it I get this result:
enter image description here

How can I handle this problem. I want to implement something like in first image. Can anybody help? Thanks

Answer

I use this in my Apps to make my navigationBar transparent (if the navigationBar is in a UINavigationController):

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

Now you can still add buttons and a title to your navigationBar.

Comments