我有一個包含 UITabBar 的 UIViewController。我想推送一個覆寫當前背景關系的新 UIViewController(因此在影片期間它顯示了覆寫 UITabBar 的新 UIViewController)。我怎樣才能做到這一點?
我嘗試使用以下內容來推送視圖,但這并沒有推送到 UITabBar。
let vc = ViewController2()
vc.modalPresentationStyle = .overFullScreen
navigationController?.pushViewController(vc, animated: true)
我還想也許我可以在 ViewController2 的 viewWillAppear 上隱藏 UITabBar 并在它的 viewWilDisappear 上顯示它;但是,這只會使 UITabBar 在關閉程序中出現(如果您慢慢滑動以關閉視圖,它看起來真的很糟糕)。
uj5u.com熱心網友回復:
在情節提要中,轉到UIViewController您要推送的內容。轉到屬性檢查器并檢查“在推送時隱藏底部欄”
這也可以通過編程方式完成:
let vc = viewController1()
vc.hidesBottomBarWhenPushed = true
navigationController?.pushViewController(vc, animated: true)
希望能幫助到你!
uj5u.com熱心網友回復:
您必須使用 presentViewController,而不是推送。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/457890.html
下一篇:Xcode13.3不鏈接情節提要
