如何在 UINavigationController 中呈現 UIViewController() ?我的控制器沒有全屏顯示。我希望我的應用看起來像這樣 在此處輸入影像描述,但最終會像這樣 在此處輸入影像描述
我在沒有情節提要的情況下制作應用程式(以編程方式)
let customVC = UIViewController()
customVC.view.backgroundColor = .green
customVC.modalPresentationStyle = .fullScreen
let navVC = UINavigationController(rootViewController: customVC)
self.present(navVC, animated: true, completion: nil)
uj5u.com熱心網友回復:
let customVC = DestinationController()
let navVC = UINavigationController(rootViewController: customVC)
// this line overFullScreen
navVC.modalPresentationStyle = .overFullScreen
// for more style
navVC.modalTransitionStyle = .crossDissolve
self.present(navVC, animated: true, completion: nil)
你想去或展示的班級
class DestinationController:UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .red
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/480805.html
