iOS 在某一个ViewController跳转到TabViewController中的某一个ViewController

要做到这个分为两步

第一步, 导入app

#import "AppDelegate.h"

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

  [self dismissViewControllerAnimated:YES completion:^{

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

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

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

        [tabViewController setSelectedIndex:2];

    }];

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

posted @ 2016-07-24 22:23  ma_fighting  阅读(3234)  评论(0编辑  收藏  举报
历史天气查