2017-12-18 125 views
1

我有一个UIViewController,其中hidesBottomBarOnPush在故事板中设置为true。视图被推到UINavigationController堆栈的顶部。 UINavigationController位于UITabBarController之内。这成功隐藏了UITabBar推。但是,当我推动另一个视图时,UITabBar仍然隐藏(尽管故事板中的hidesBottomBarOnPush设置为false)。我怎样才能让它只隐藏那个视图的UITabBar? 谢谢!只在导航堆栈内的一个视图中隐藏标签栏

+0

你应该推新控制器之前,在代码中表现出来。 –

+0

@ biloshkurskyi.ss您是对的,我需要在推送视图之前将代码添加到viewWillAppear中,而不是使用情节提要。 – Tometoyou

+0

发布您的代码并检查为正确答案。也欢迎你。 –

回答

0

你必须设置falsehidesBottomBarWhenPushed

override var hidesBottomBarWhenPushed: Bool { 
    get { 
     return navigationController?.topViewController == self 
    } 
    set { 
     super.hidesBottomBarWhenPushed = false 
    } 
}