I have three viewController
First, Second and Third
from Second to open Third I use
Third *third = [[Third alloc]initWithNibName:@"Third" bundle:nil];
[self presentModalViewController:third animated:YES];
[third release];
Now I want return from third to first; then I set in viewDidAppear in second this code:
[self dismissModalViewControllerAnimated:NO];
but for 1 second I see Second and I don't want watch it...how can I do?
e.g. root A -> Presents B -> Presents C and you want to dismiss to the A from C, you can officialy by calling dismissViewControllerAnimated on rootViewController . [[UIApplication sharedApplication]. delegate.
Use unwind segue instead of using RootViewController. Using unwind you can go back to any ViewController. DismissViewController always send the controller out from NavigationController.
You need to dismiss third view controller first and then second Viewcontroller. Do the following code when you want to go first view controller.
-(void)goToFirstView{
UIViewController *vc = [self parentViewController];
// UIViewController *vc = [self presentingViewController]; //ios 5 or later
[self dismissModalViewControllerAnimated:NO];
[vc dismissModalViewControllerAnimated:YES];
}
How is the Third modal view being dismissed in the first place? Perhaps by the user touching a 'Done' button? If so, it is in the handler for the button that you want to dismiss both.
You can dismiss both as:
[self dismissModalViewControllerAnimated: YES];
[self.presentingViewController dismissModalViewControllerAnimated: NO];
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