I am getting this error when I call my method dismissView. Here is the method stub:
-(IBAction)dismissView
{
RootViewController *rootController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:nil];
[self.navigationController popToViewController:rootController animated:YES];
}
That should work, and I've checked, rootController is initialized and allocated. Any ideas?
If you need to find the view controller that is responsible for a particular view, the easiest thing to do is walk the responder chain. This chain is built into all iOS apps, and lets you walk from one view up to its parent view, its grandparent view, and so on, until it reaches a view controller.
Open your storyboard where your different viewController are located. Tap the viewController you would like your navigation controller to start from. On the top of Xcode, tap "Editor" -> Tap embed in.
Pushes a view controller onto the receiver's stack and updates the display. func popToRootViewController(animated: Bool) -> [UIViewController]? Pops all the view controllers on the stack except the root view controller and updates the display.
I had this problem recently and solved with something like this...
[self.navigationController popToViewController:[self.navigationController.viewControllers objectAtIndex:1] animated:YES];
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