要做到这个分为两步

第一步, 导入app

#import "AppDelegate.h"

第二步, 监听方法中先写加入以下代码:

  [self dismissViewControllerAnimated:YES completion:^{

        // 这是从一个模态出来的页面跳到tabbar的某一个页面

        AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];

        UITabBarController *tabViewController = (UITabBarController *) appDelegate.window.rootViewController;

        [tabViewController setSelectedIndex:2];

    }];

这样, 就实现了想要的效果.

相关文章: