Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hide Navigation Bar on root view controller and show it otherwise - Swift [duplicate]

Tags:

ios

swift

iphone

I need to hide the navigation bar only from the root view controller,

when i try to hide it from the storyboard by disabling the "Show Navigation Bar", it is hidden from all the other view controllers connected to that root view controller.

what can be possible solution ?

like image 226
MBH Avatar asked Apr 29 '15 20:04

MBH


1 Answers

I solved it with this code:

override func viewWillDisappear(_ animated: Bool) {
    self.navigationController?.setNavigationBarHidden(false, animated: animated);
    super.viewWillDisappear(animated)
}

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    self.navigationController?.setNavigationBarHidden(true, animated: animated)
}
like image 97
MBH Avatar answered Nov 03 '22 08:11

MBH