0

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

Neenu
  • 6,848
  • 2
  • 28
  • 54
  • how do you set the 'prompt'? – Michał Ciuba Nov 20 '14 at 09:54
  • For the ROOT UITableViewController, I set prompt to nil: [[self navigationItem] setPrompt: nil]; – user3048615 Nov 20 '14 at 10:55
  • in which method do you call `setPrompt` in root view controller? – Michał Ciuba Nov 20 '14 at 12:09
  • `viewDidLoad` is (usually) called only once for a `UIViewController`, when it's initialized. So it's not called when you pop to the root view controller. Try to move this code to `viewWillAppear`. – Michał Ciuba Nov 20 '14 at 12:20
  • It's not working either. The thing is, when I push just one UITableViewController on top of the ROOT UITableViewController, it's working, the prompt disappears, but pushing more than one UITableViewController, it's not working anymore... – user3048615 Nov 20 '14 at 12:37

2 Answers2

0

try calling the property on the stack

[self.navigationController popToRootViewControllerAnimated: YES];
0

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.

ToBro
  • 21
  • 3
  • 1
    Please take a look at [answer] for information on how to and what is an appropriate answer for a question. Comments such as `Me too` are not valid answers and should not be created. – Lilith Daemon Apr 13 '16 at 03:33