Reputation: 457
I have a UINavigationController that is Linked to a ViewController that is set as RootController. I have enabled the UINavigationBar and put 3 UIViews each with a UIButton inside. Ideally I would like to make the UINavigationBar completely invisible, but I would also settle for setting the color to the background color of my ViewController. I am working in swift and I have tried things like
self.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: UIBarMetrics.Default)
self.navigationBar.shadowImage = UIImage()
self.navigationBar.translucent = true
However nothing changes. Is there a correct way to do this?
Upvotes: 2
Views: 2431
Reputation: 4363
In swift, you can do:
self.navigationController?.setNavigationBarHidden(true, animated: true)
Please refer to Documentation for more details.
Upvotes: 4
Reputation: 1434
I am also using Swift and was calling setNavigationBarHidden
with no effect. I created a helper method in Obj-C that calls setNavigationBarHidden:animated:
on a given navigation controller, and that works fine. So apparently this is just a bug, very frustrating.
Upvotes: 0