popToRootViewControllerAnimated doesn't set the prompt properly

212 views Asked by At

I have a simple scenario : a UINavigationController with several embed UITableViewControllers.
Each UITableViewController has a prompt set, except for the ROOT UITableViewController (no prompt).
And in each UITableViewController, there is a UIBarButtonItem to go back to the ROOT UITableViewController:

- (void) backHome {
  [[self navigationController] popToRootViewControllerAnimated: YES];
}

It actually goes back to the ROOT UITableViewController, but it keep the prompt from the last UITableViewController, while it suppose to remove it ( knowing that the ROOT UITableViewController doesn't have a prompt).
But when I use and hit several time a custom UIBarButtonItem with the code :

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

it remove the prompt as expected.

Why popToRootViewControllerAnimated doesn't remove the prompt ? Especially in iOS 8.x. Because it's working in iOS 7.1.2
I use the latest Base SDK 8.1

2

There are 2 answers

0
AudioBubble On

try calling the property on the stack

[self.navigationController popToRootViewControllerAnimated: YES];
1
ToBro On

I have a similar issue and can confirm that it still exists with current Xcode & Simulator. I have a prompt on all View Controllers in the Navigation Controller except for the last one.

Popping to root without animation works for me and shows the prompt again, which otherwise wouldn't show.