【问题标题】:Hiding UITabBar when showing UIViewController as modal将 UIViewController 显示为模式时隐藏 UITabBar
【发布时间】:2011-04-20 09:57:11
【问题描述】:

我有一个 UIViewController,它有一个模式窗口,我想在整个界面上呈现它,包括 UITabBar。

我的应用层次结构是这样的:

UITabBarController (A) ->
    UIViewController (B) ->
        UINavigationController (C) ->
            UIViewController (D) ->
                UIViewController (my modal view)

当我在 D 上调用 presentModalViewController 时,模态视图显示在 UITabBar 下方,或者应该说,UITabBar 仍然显示。

我尝试在模态视图控制器上将hidesBottomBarWhenPushed 属性设置为YES,但无济于事。

关于为什么这对我不起作用的任何想法?

【问题讨论】:

  • 我从来没有遇到过这个问题。我所有的模态都显示在标签栏上。我认为这将是您的控制器层次结构。通常是UITabBarController->UINavigationController->UIViewController。如果您没有充分的理由这样做,我认为您必须删除 (B)。

标签: uiviewcontroller ios uitabbarcontroller


【解决方案1】:

模态 ViewController 必须是 TabBarController 的直接子代才能执行您想要的操作。

在 ViewController "D" 中,而不是:

[self presentModalViewController:...];

做:

[tabBarController presentModalViewController:...];

如何维护对TabBarController 的引用取决于您。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-12-07
    • 1970-01-01
    • 1970-01-01
    • 2010-10-15
    • 2011-12-03
    相关资源
    最近更新 更多