1
UIViewController *vc = self.presentingViewController;
if (!vc.presentingViewController) return;
while (vc.presentingViewController) {
vc = vc.presentingViewController;
}
[vc dismissViewControllerAnimated:YES completion:nil];
2
TargetVC *target = [[TargeVC alloc] init];
UIViewController *vc = self.presentingViewController;
if (!vc.presentingViewController) return;
while (![vc isKindOfClass:[target class]]) {
vc = vc.presentingViewController;
}
[vc dismissViewControllerAnimated:YES completion:nil];
3
if ([self respondsToSelector:@selector(presentingViewController)]) {
[self.presentingViewController.presentingViewController
dismissViewControllerAnimated:YES completion:nil];
}