欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

iOS开发返回指定控制器

程序员文章站 2022-06-04 13:18:13
...

MainTarBarController这个改为要返回的控制器

UIViewController * presentingViewController = self.presentingViewController;
    
    do {
        if ([presentingViewController isKindOfClass:[MainTarBarController class]]) {
            break;
        }
        presentingViewController = presentingViewController.presentingViewController;

    } while (presentingViewController.presentingViewController);
    
    [presentingViewController dismissViewControllerAnimated:YES completion:nil];