I am getting this error when I call my method dismissView. Here is the method stub:
-(IBAction)dismissView
{
RootViewController *rootController = [[RootViewC
The UINavigationController has a stack of ViewControllers which is stored in the viewControllers(NSArray) property. Enumerate to the required ViewController and pop to that ViewController.
Following code should solve the problem.
-(IBAction)dismissView
{
NSArray *array = self.navigationController.viewControllers;
for (id controller in array) {
if ([controller isKindOfClass:[RootViewController class]]) {
[self.navigationController popToViewController:controller animated:YES];
}
}
}