[英]Hiding UITabBar when showing UIViewController as modal
I've got a UIViewController that has a modal window which I'd like to present over the entire interface, including the UITabBar. 我有一个UIViewController,它具有一个模态窗口,我想在整个界面(包括UITabBar)上进行呈现。
My application hierarchy is this: 我的应用程序层次结构是这样的:
UITabBarController (A) ->
UIViewController (B) ->
UINavigationController (C) ->
UIViewController (D) ->
UIViewController (my modal view)
When I call presentModalViewController
on D, the modal view is presented but underneath the UITabBar, or should I say, the UITabBar is still shown. 当我在D上调用
presentModalViewController
时,模态视图将显示在UITabBar的下面,或者应该说UITabBar仍然显示。
I've tried setting the hidesBottomBarWhenPushed
property to YES
on the modal view controller, but to no avail. 我试过在模态视图控制器
hidesBottomBarWhenPushed
属性设置为YES
,但无济于事。
Any ideas on why this isn't working for me? 有什么想法为什么对我不起作用?
The modal ViewController
needs to be a direct child of the TabBarController
in order to do what you want. 模态
ViewController
必须是TabBarController
的直接子代才能执行所需的操作。
in ViewController "D", instead of : 在ViewController“ D”中,而不是:
[self presentModalViewController:...];
do: 做:
[tabBarController presentModalViewController:...];
how you maintain a reference to the TabBarController
is up to you. 如何维护对
TabBarController
的引用取决于您。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.