Problems with buttons with navigation controller (iPhone)

So, here is the functionality I'm looking for:
1. The main menu does not have a navigation bar
2. All other screens from the main menu.
3. It should animate correctly

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

In the main menu of viewDidLoad, I just go:

[self.navigationController setNavigationBarHidden:YES];

In another window (Screen1) in his viewDidLoad I go:

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

So, when I run the program. I have my own button in the main menu, when you click on it, it goes to Screen1, and the animation works correctly: i.e. there is no bar in the main menu, but as soon as I press the button, Screen1 will move using its navigation controller Bar. So far, so good.

But here is the problem, when I press the back button to return to the main menu from screen 1, the navigation controller panel is stored there (that is, it does not call the main menu viewDidLoad), but I don’t know, t want bars in my main menu! Any ideas?

+3
source share
2 answers

Do not use viewDidLoad, use viewWillAppear:or viewDidAppear:(depending on what looks best to you). viewDidLoadIt is called only once, when the view is first viewed.

+4
source

What if you try to hide it in viewDidAppearinstead viewDidLoad?

+1
source

Source: https://habr.com/ru/post/1733730/


All Articles