[英]Pushing UIViewController above UITabBar
我有一個名為UIViewController
的ListVC
。 ListVC
有一個UITabBar
,用戶可以使用它來切換標簽。 它還具有UINavigationController
。
在ListVC
中,我有一個按鈕,我想在按下時推送一個名為DetailVC
的新 ViewController(使用NavigationController
)。 我想在沒有UITabBar
的情況下展示DeatilVC
。
問題是當我使用pushViewController(animated)
方法時,視圖仍然有UITabBar
。
如何將視圖(我不想以模態方式呈現)推到UITabBar
上方?
從聊天列表中選擇聊天時,您可以在Whatsapp
上看到它的示例。 圖片:
代碼:
self.navigationController?.pushViewController(detailVC, animated: true)
謝謝
好的,我已經解決了這個問題。 我必須在推送代碼之前和之后添加hidesBottomBarWhenPushed
兩次:
self.hidesBottomBarWhenPushed = true self.navigationController?.pushViewController(detailVC, animated: true) self.hidesBottomBarWhenPushed = false
嘗試這個
override func viewWillDisappear(_ animated: Bool) { self.tabBarController?.tabBar.isHidden = true } override func viewWillAppear(_ animated: Bool) { self.tabBarController?.tabBar.isHidden = false }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.