iOS 根据推送内容进行Push操作

1.获取根视图

UITabBarController * tab = (UITabBarController *)self.window.rootViewController;

2.返回根目录

        UINavigationController * navChoose = tab.viewControllers[tab.selectedIndex];

3.如果不在RootVc,让他Pop到RootVc

        [navChoose popToRootViewControllerAnimated:NO];
        //跳转到主页(打开APP,让他在主页进行跳转,也可以在其他页面).
        tab.selectedIndex = 0;  

4.主页Push(用UINavigationController里面的第一个控制器进行Push).

        UINavigationController * index = (UINavigationController *)tab.viewControllers[0];

5.隐藏TabBar

        index.viewControllers[0].hidesBottomBarWhenPushed = YES;

6.进行Push操作

        WYSGoodsDetailFatherController * gdvc = [[WYSGoodsDetailFatherController 
         alloc]init];
        gdvc.goods_ids = good_id;
        //Push
        [index pushViewController:gdvc animated:NO];
        //显示TabBar
        index.viewControllers[0].hidesBottomBarWhenPushed = NO;

你可能感兴趣的:(iOS 根据推送内容进行Push操作)