仅在导航堆栈内的一个视图上隐藏选项卡栏

问题描述 投票:1回答:1

我有一个UIViewController,在故事板中将hidesBottomBarOnPush设置为true。视图被推到UINavigationController堆栈的顶部。这个UINavigationControllerUITabBarController里面。这成功地隐藏了UITabBar。然而,当我在其上推动另一个视图时,UITabBar仍然被隐藏(即使在故事板中hidesBottomBarOnPush设置为false)。我怎样才能让它只隐藏那个视图的UITabBar?谢谢!

ios swift
1个回答
0
投票

你必须将false设置为hidesBottomBarWhenPushed

override var hidesBottomBarWhenPushed: Bool {
    get {
        return navigationController?.topViewController == self
    }
    set {
        super.hidesBottomBarWhenPushed = false
    }
}
© www.soinside.com 2019 - 2024. All rights reserved.