iOS Dev: Hide Navigation Bar

Sometimes, it is needed to hide the navigation bar on first view or on all views. To do so, add the following code to your root view controller class or extend already existing methods by the relevant code snippets:

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
     [self.navigationController setNavigationBarHidden:YES animated:NO];
     return self;
}
-(void) viewDidAppear: (BOOL)animated {
     [[self navigationController] setNavigationBarHidden:YES animated:NO];
     [super viewDidAppear:animated];
}
- (void)viewDidLoad {
     [super viewDidLoad];
     [self.navigationController setNavigationBarHidden:YES animated:NO];
}

Leave a comment