How to hide a navigation bar from first ViewController in Swift?
refer to :
http://stackoverflow.com/questions/29209453/how-to-hide-a-navigation-bar-from-first-viewcontroller-in-swift
override func viewWillAppear(_ animated: Bool) { super.viewWillAappear(animated) // Hide the navigation bar on the this view controller self.navigationController?.setNavigationBarHidden(true, animated: true) } override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) // Show the navigation bar on other view controllers self.navigationController?.setNavigationBarHidden(false, animated: true) }
Principle: Because the setNavigationBarHidden setting is global, all pages will respond. So it is realized by disappearing when the page appears and showing when it goes to other pages.
object-c method:
-(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; self.navigationController.navigationBarHidden = YES; } -(void)viewWillDisappear:(BOOL)animated{ [super viewWillDisappear:animated]; self.navigationController.navigationBarHidden = NO; }