【发布时间】:2016-06-07 15:52:27
【问题描述】:
我的目标只是在用户导航到特定屏幕时删除我的应用的标签栏,以便我有更多可用空间。
目前,我的故事板如下所示:
当用户点击一个按钮时,他们将被带到另一个屏幕,这是序列中的最后一个屏幕。我的目标是简单地删除标签栏,但保留导航。
如果我使用show detail segue,那么它会删除标签栏以及导航,这是我不想要的。
这是最后一个屏幕(但它仍然有标签栏):
【问题讨论】:
我的目标只是在用户导航到特定屏幕时删除我的应用的标签栏,以便我有更多可用空间。
目前,我的故事板如下所示:
当用户点击一个按钮时,他们将被带到另一个屏幕,这是序列中的最后一个屏幕。我的目标是简单地删除标签栏,但保留导航。
如果我使用show detail segue,那么它会删除标签栏以及导航,这是我不想要的。
这是最后一个屏幕(但它仍然有标签栏):
【问题讨论】:
您甚至可以在您的DestinationViewController 上将属性hidesBottomBarWhenPushed 设置为等于true。您可以在 prepareForSegue 方法覆盖中执行此操作。
if let vc = segue.destinationViewController as? YOURVIEWCONTROLLER {
vc.hidesBottomBarWhenPushed = true
}
这样,如果ViewController在其他情况下需要底栏,就会显示出来
【讨论】:
你可以像下面这样写prepareforsegue,
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
segue.destinationViewController.hidesBottomBarWhenPushed = YES;
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
斯威夫特:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
segue.destinationViewController.hidesBottomBarWhenPushed = true
}
所以在目标视图控制器标签栏不会显示。
根据您的问题,您可以在FirstTableViewcontroller 中实现,标签栏在TaretViewController 中将不可见。
希望这会有所帮助:)
【讨论】:
隐藏在视图中会消失
self.tabBarController.tabBar.hidden = YES;
【讨论】: