Shai UI
Shai UI

Reputation: 51958

Back Button Issues With Navigation Controller (iPhone)

So here's the functionality that I'm looking for:
1. Main Menu doesn't have the navigation Bar
2. All other screens from the Main Menu do.
3. It should animate correctly

I partially got this to work (just not the back button part).

In the Main Menu viewDidLoad I just go:

[self.navigationController setNavigationBarHidden:YES];

In another window (Screen1), in its viewDidLoad I go:

[self.navigationController setNavigationBarHidden:NO animated:YES];

So now, when I run the program. I have my own button in the main menu that when you click it, it transitions to Screen1, and the animation works properly: I.e., no bar in main menu but and as soon as I hit the button, Screen1 slides in with its Navigation Controller Bar. So far so good.

But here's the problem, when I click the "back" button to go back to my Main Menu from Screen1 it keeps the Navigation Controller Bar up there (i.e., it doesn't call the Main Menu's viewDidLoad) but I don't want a Bar in my main menu! Any ideas?

Upvotes: 3

Views: 972

Answers (2)

Brian Moeskau
Brian Moeskau

Reputation: 20431

What if you try hiding it in viewDidAppear instead of viewDidLoad?

Upvotes: 1

Ian Henry
Ian Henry

Reputation: 22403

Don't use viewDidLoad, use viewWillAppear: or viewDidAppear: (depending on which looks better for you). viewDidLoad is only called once, the first time the view loads.

Upvotes: 4

Related Questions