这是我的情况:
我在 UITabBarController
内有一个 UINavigationController
。当我向下钻取导航 Controller 时,在某些时候我必须隐藏 UITabBar
因为我希望 View 拥有尽可能多的空间。
我通过在推送的 UIViewController 内使用 self.hidesBottomBarWhenPushed = YES 来做到这一点,并且效果很好。
但是,我想在以下推送的 Controller 中显示 UITabBar
。我尝试将 self.hidesBottomBarWhenPushed = NO
放入其他 Controller 中,但 UITabBar 不会回来。
正如文档所述,这似乎是正常的:
当按下时隐藏BottomBar
如果是,则隐藏屏幕底部的栏;否则,不。如果是,底部栏将保持隐藏状态,直到 View Controller 从堆栈中弹出。
事实上,当弹出此属性设置为 yes 的 Controller 时,选项卡栏确实会回来。
当 Controller 被按下时,一旦 Controller 被隐藏,是否有任何正确的方法来显示UITabBar
?
提前致谢
最佳答案
hidesBottomBarWhenPushed 并未弃用。 我发现使用以下方法实现UITabBar的隐藏和显示非常简单:
self.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
self.hidesBottomBarWhenPushed = NO;
所以在你推送detailViewConroller之后,你应该将hide属性重置回NO。 这样,当详细信息 View 弹出时,它将再次显示。 不需要对 viewWillApear/disapear 等进行任何额外的更改。 享受。
关于iphone - 当 UIViewController 推送时显示 UITabBar,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5072382/