I have a root vc embed in the navigation vc, I set the navigation bar hidden using
[self.navigationController setNavigationBarHidden:YES];
It works fine, the navigation bar disappears.
And push the 2nd vc use
[self.navigationController pushViewController:controller animated:YES];
In the 2nd vc set the navigation bar display. Everything goes well.
So when I clicked the 'back button' on the navigation bar, I found the navigation bar disappeared faster than the view, especially set the view's background to black, I can see
the whole view is black just like there're not any navigation bar ever.
I don't want this, I just hope the navigation bar will always present until the viewDidDisappear.
Here is a picture of the problem
I use [self.navigationController popViewControllerAnimated:YES];
and must fill the Animated is YES can reproduce this appearance.
For the sort,
- Two vc in the navigation vc.
- Root vc's navigation bar was hidden,the 2nd VC pushed from the root vc.
- The 2nd vc made the navigation bar display.
- Use
[self.navigationController popViewControllerAnimated:YES]
to back.
Where is the code location:
ps:whatever how you set the navigation bar's hidden-property, in ViewDidLoad or ViewWillAppear or ViewDidAppear or other place, they are all the same appearance.
in the root vc's viewDidLoad
[self.navigationController setNavigationBarHidden:YES];
and root vc's didSelectRowAtIndexPath:
[self.navigationController setNavigationBarHidden:NO];
Where is Wrong
How to solve