How can I make the UINavigationController UINavigationBar invisible or at least change the color

I have a UINavigationController that is associated with a ViewController that is set as RootController. I turned on the UINavigationBar and put 3 UIViews with UIButton inside. Ideally, I would like to make the UINavigationBar completely invisible, but I would also decide to set the color to the background color of my ViewController. I work fast and I have tried things like

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

However, nothing is changing. Is there a proper way to do this?

+3
source share
2 answers

In fast mode, you can:

 self.navigationController?.setNavigationBarHidden(true, animated: true) 

See Documentation for more details.

+5
source

I also use Swift and called setNavigationBarHidden with no effect. I created a helper method in Obj-C that calls setNavigationBarHidden:animated: on this navigation controller, and this works fine. Apparently, this is just a mistake, very frustrating.

0
source

All Articles