iOS经验总结

IOS tabbar的跳转

2020-11-21  本文已影响0人  夜涂黑

第一种方案:

    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;

上一篇 下一篇

猜你喜欢

热点阅读