在标签栏控制器中加载应用程序时,特定的标签栏项是否隐藏? [英] particular tabbar item hide when app loads in Tab bar controller?

查看:47
本文介绍了在标签栏控制器中加载应用程序时,特定的标签栏项是否隐藏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Appdelegate.m文件中添加了以下内容,以在选项卡栏控制器(由IB创建)中隐藏特定的选项卡栏项("Hai").但它不起作用

i have added the following in Appdelegate.m file to hide particular tab bar item("Hai") in tab bar controller(created by IB).but it did not work

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

    }

推荐答案

无法隐藏选项卡栏项,但是您可以创建一个视图控制器数组,并将该特定控件从该数组中排除.稍后,当该选项卡应该可见时,

There is no way to hide a tab bar item, but you could create an array of view controllers and exclude this particular one from that array. Later when the tab should be visible, set the view controllers for the tab bar controller again and include that view controller this time.

- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated

这篇关于在标签栏控制器中加载应用程序时,特定的标签栏项是否隐藏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆