self.navigationController.tabBarController.selectedIndex not working

前端 未结 7 2030
野趣味
野趣味 2021-01-14 02:07

I have a UITabBarController which containing 4 different UIViewControllers.

On first tab there is a UINavigationViewController

7条回答
  •  失恋的感觉
    2021-01-14 03:10

    we should put follow section in viewDidAppear.

        - (void)viewDidAppear:(BOOL)animated
    {
    NSArray *ary = [self.tabBarController viewControllers];
        UIViewController *vc = ary[3];
        [self.tabBarController setSelectedIndex:3];
        [self.tabBarController setSelectedViewController:vc];
    }
    

提交回复
热议问题