第一种:
__weak LoginViewController * weakSelf = self;
AppDelegate * appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
UIViewController * controller = appDelegate.window.rootViewController;
UITabBarController * tabBarController = (UITabBarController *)controller;
[tabBarController setSelectedIndex:3];
//假如要跳转到第四个tabBar那里,因为tabBar默认索引是从0开始的
[weakSelf.navigationController popToRootViewControllerAnimated:YES];
第二种:
__weak viewController * weakSelf = self;
weakSelf.navigationController.tabBarController.selectedIndex = 3;
[weakSelf.navigationController popToRootViewControllerAnimated:NO];