2017-12-18 126 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 
    } 
}