iOS presentViewController两个视图控制器的时候返回根视图

 if ([self respondsToSelector:@selector(presentingViewController)]){
        self.presentingViewController.view.alpha = 0;
        [self.presentingViewController.presentingViewController dismissViewControllerAnimated:YES completion:nil];
    }else {
        self.presentingViewController.view.alpha = 0;
        [self.parentViewController.parentViewController dismissViewControllerAnimated:YES completion:nil];
    }

你可能感兴趣的:(ios)