Nav Bar disappears on popviewcontroller

In one of my views, when a button is clicked, I call another view, which is a SplitViewController . If this SplitViewController is called through one of these buttons, I have special objects to add to the view. basically just navigation bar items like a cancel button. This idea can be obtained elsewhere, and these elements are not needed, so there is a special condition.

However, when the user is finished, and I pulled the ViewController back to the previous screen that was selected, the navigation bar disappears on this screen. I don’t tie it to the hidden one and I don’t do anything with the navigation bar. Just add a SplitViewController and then drop it back.

Some codes.

 //declare the split screen VC SplitScreenViewController *split = [[SplitScreenViewController alloc] init]; //set the flag that this VC is coming from a button, so we need the extra nav bar items [split setIsFromButton:YES]; [self.navigationController pushViewController:split animated:YES]; 

now the callback is just ...

 - (void)cancelSelectionBtnClicked { [self.navigationController popViewControllerAnimated:YES]; } 

and when the view returns, the navigation bar has disappeared.

any ideas?

edit it should be noted that this is the same done elsewhere in the same way (as far as I can tell), and the navigation bar is displayed upon return.

+6
source share
2 answers

In your ViewController viewWillAppear you can again make the navigationBar visible.

 - (void)viewWillAppear:(BOOL)animated { [self.navigationController setNavigationBarHidden:NO]; } 
+9
source

In UISplitViewController, I found various strange behaviors in the navigator, and in some cases it was because the controller was not installed as the rootViewController of the window, and not inside the navigation controller as you configured.

+1
source

All Articles