Hiding the navigation bar on a specific view controller within a navigation controller

I need help removing the status bar from a specific View Controller. Despite attempting to hide it, I still see a blue line. Any suggestions for successfully hiding the navigation bar (while keeping the status bar) on my initial view controller?

Question:

I have 8 view controllers embedded into a single navigation controller. My intention is to Hide the navigation bar (while keeping the status bar) only on my first view controller. However, when I attempt to do so, the navigation bar disappears on all of my view controllers.



Solution:


Attempt this within the initial view controller.

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:YES animated:animated];
}
- (void)viewWillDisappear:(BOOL)animated {
    [self.navigationController setNavigationBarHidden:NO animated:animated];
    [super viewWillDisappear:animated];
}

Frequently Asked Questions

Posted in Ios