【问题标题】:How to set programmatically "Hides bottom bar on push"?如何以编程方式设置“在推送时隐藏底栏”?
【发布时间】:2012-05-27 06:32:09
【问题描述】:

我正在从具有底部标签栏的 tableview 以编程方式构建视图。 选择桌面单元格时,我希望这个底部条消失。 我可以这样做:

self.tabBarController.tabBar.hidden = YES;

但视图的大小保持不变,就好像标签栏仍然存在一样。 我看到,如果视图是在情节提要上构建的,并且通过设置复选标记“在推送时隐藏底部栏”,视图会调整大小以占用标签栏留下的空闲空间。 我怎样才能以编程方式做到这一点?

【问题讨论】:

    标签: iphone xcode ios5


    【解决方案1】:

    使用Swift

    let viewController = CustomViewController()
    viewController.hidesBottomBarWhenPushed = true
    
    self.navigationController?.pushViewController(viewController, animated: true)
    

    【讨论】:

      【解决方案2】:
      self.hidesBottomBarWhenPushed = YES;
      [self.navigationController pushViewController:self.anotherViewController animated:animated];
      

      对于您推动的特定视图控制器。使用此代码

          TheViewController* theController = [[TheViewController alloc] initWithNibName:@"TheViewController" bundle:nil];
          theController.hidesBottomBarWhenPushed = YES;
          [self.navigationController pushViewController:theController animated:YES];
          [theController release];
      

      现在标签栏将被隐藏并自动显示。享受时光:)

      【讨论】:

      • 我这样做了,但问题是返回 tableview 时标签栏仍然隐藏。完成详细视图后,有没有办法再次显示该标签栏?
      • 这将隐藏特定的视图控制器
      • 是的!谢谢。从字面上看,我花了几个小时:(你在几秒钟内解决了它:)
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-28
      • 2017-07-06
      • 1970-01-01
      • 2013-10-04
      • 2018-07-23
      • 1970-01-01
      相关资源
      最近更新 更多