Popping viewcontroller and then back to RootViewController doesn't seem to work Popping viewcontroller and then back to RootViewController doesn't seem to work objective-c objective-c

Popping viewcontroller and then back to RootViewController doesn't seem to work


As suggested by Mark, you should use -popToRootViewController from your 4rth view controller, instead of 3rd view controller, as your motive is to pop it to root view controller.

BUT if you still want to achieve this functionalty for some anonymous reason, then in the 3rd viewcontroller, use :

[self.navigationController popToRootViewControllerAnimated:YES] in viewDidAppear method, instead of viewWillAppear.

I hope it works :)


There doesn't appear to be any reason to pop back to view controller 3, since you're trying to go to the root before view controller 3's view even appears. Just send -popToRootViewControllerAnimated: to view controller 4.