I have a typical UITableViewController set of views. On all views is a button, which brings up a model view. On that Settings view is a button. I would like that button to dismiss the modal view and implement popToRootViewController on the UITableViewController's navigationController.
Dismissing the modal view is easy:
[self dismissModalViewControllerAnimated:NO];
and that works fine. I've tried this to pop the main UITableViewController:
[self.parentViewController.navigationController popToRootViewControllerAnimated:NO];
and nothing happens.
I can probably implement a delegate to make this happen but there are quite a few view controllers with the same Settings button (with more to come) so a preference to find a solution that doesn't require additional code in each view controller.
Many thanks!
check out the answer by rdelmal (https://stackoverflow.com/a/16311935/1395563), this worked like a charm for me. I use this code in an action in the modal view.
[(UINavigationController *)self.presentingViewController popToRootViewController:NO];
[self dismissViewControllerAnimated:YES completion:nil];
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