On one of my views, when a button is pressed I call another view that is a SplitViewController
. If this SplitViewController
is called via one of these buttons I have special objects to add to the view. mostly just nav bar items, like a cancel button. This view can be accessed elsewhere and these items are not needed which is why there is the special condition.
However, when the user is done and i pop the ViewController
back to the previous screen that was selected, the nav bar disappears on that screen. I am not setting it to hidden nor am I doing anything strange with the nav bar. Simply adding the SplitViewController
then popping back.
Some code..
//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 call back is simply...
- (void)cancelSelectionBtnClicked
{
[self.navigationController popViewControllerAnimated:YES];
}
and when the view returns, the nav bar is gone.
any ideas?
edit it should be noted this exact same thing is done elsewhere the same way(as far as I can tell) and the nav bar is visible on return.
In your ViewController's viewWillAppear
you can again make your navigationBar
visible.
- (void)viewWillAppear:(BOOL)animated
{
[self.navigationController setNavigationBarHidden:NO];
}
I have seen various strange navbar behavior in UISplitViewController's, and in a few cases it was because the controller was not set as the rootViewController of the window as opposed to inside a navigation controller like you have set up.
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