I am trying to dismiss two view controllers one after the another, In my first view controller I have kept uploading feature, which when completes the current view controller is dismissed.
Now, after the uploading ViewController is dismissed,I come to previous viewcontroller. I want to dismiss that "previousViewController" as well.
After the "uploadViewController" is dismissed, I call method on "PreviousViewController"
Here is how I am trying to do it:
In UploadViewController:
[self dismissViewControllerAnimated:YES completion:^{
[previousView dismissME];
}];
And now when I come to "PreviousViewController"
Here is that dismissME
method:
-(void)dismissME {
if (![[self presentingViewController] isBeingDismissed]) {
NSLog(@"Dismiss ME");
[self dismissViewControllerAnimated:YES completion:NULL];
}
}
I get that "Dismiss ME" log, but the viewController is not being dismissed.
Any ideas .. ? How to achieve this ..?
This code helps in dismissing the previous two viewcontrollers.
[[[self presentingViewController] presentingViewController] dismissModalViewControllerAnimated:YES];