IOS tabbar的跳转

第一种方案:

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

    UIViewController * controller = appDelegate.window.rootViewController;

    UITabBarController * tabBarController = (UITabBarController *)controller;

    [tabBarController setSelectedIndex:3];

    //假如要跳转到第四个tabBar那里,因为tabBar默认索引是从0开始的

    [self.navigationController popToRootViewControllerAnimated:YES];


第二种方案:

    self.navigationController.tabBarController.selectedIndex = 3;

第三种方案:

self.tabBarController.selectedIndex = 3;

你可能感兴趣的:(IOS tabbar的跳转)