I have made a simple app using the Storyboard editor in xcode 4.6.3. The first view is a navigation controller with some simple buttons for navigation. This then by default adds the navigation bar to the top of each new view I create when I connect the buttons to each of their pages.
However, I want the first page (landing page I guess I would call it) to have no top bar. I follow the instructions here on how to disable the top navigation bar in Storyboard mode. However, this then disables all navigation bars for all views linked to this main view.
I also change the colour of sub pages' top navigation bars but this does not work either. I run the application on the emulator but the changes dont seem to take affect.
Can anyone please advise? I am new to objective c (experience in Java mostly) and would like to get an app out quickly. My problem is time and Storyboard seems to have solved this as I can get something together fairly quickly.
I just fired up an app and had the same issue, the line you are looking for is:
self.navigationController.navigationBar.hidden = YES;
Full Code is:
- (void)viewWillAppear:(BOOL)animated
{
self.navigationController.navigationBar.hidden = YES;
}
Make sure you turn it back on with the next controller:
self.navigationController.navigationBar.hidden = NO;
Was only tested in a later version of Xcode but should work fine for 4.6.3
(edit to change from viewDidLoad to viewWillAppear)
in Swift you can use the almost obvious
self.navigationController?.navigationBar.isHidden = true
and
self.navigationController?.navigationBar.isHidden = false
to show or hide the navigation bar. make sure you allow the view to load so call those in viewWillAppear or viewDidAppear.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With