Does a particular tab element hide when the application loads into the controller of the tab bar?

HI, I added the following to the Appdelegate.m file to hide a specific tab bar item ("Hai") in the tab bar controller (created by IB). But it didn’t work

 - (void)tabBarController:(UITabBarController *)tabBarController    didSelectViewController:(UIViewController *)viewController 
   {
  if ([viewController.tabBarItem.title isEqualToString:@"Hai"])
      {
      self.tabBarController.tabBar.hidden = YES;
  }

    }
+3
source share
1 answer

You cannot hide a tab bar item, but you can create an array of view controllers and exclude this particular one from this array. Later, when the tab should be visible, reinstall the view controllers for the tab bar controller and turn on the view controller this time.

- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated
+4
source

Source: https://habr.com/ru/post/1729536/


All Articles