使用 self.present 调用 VC 时不显示 navigationItem

navigationItem not displayed when VC called with self.present

需要帮助,因为我已经苦苦挣扎了几天...

我有一个 VC 带有从 viewDiDLoad 调用的导航项:

override func viewDidLoad() {
    super.viewDidLoad()
    self.customization()
    self.fetchData()
}

...

func customization() {
        self.navigationItem.title = self.currentUser?.displayName
    self.navigationItem.setHidesBackButton(true, animated: false)
    let icon = UIImage.init(named: "back")?.withRenderingMode(.alwaysTemplate)
    let backButton = UIBarButtonItem.init(image: icon!, style: .plain, target: self, action: #selector(self.dismissSelf))
    backButton.tintColor = UIColor(red: 0.0157, green: 0.498, blue: 0, alpha: 1.0)
    self.navigationItem.leftBarButtonItem = backButton
    self.locationManager.delegate = self
    print("called customization()")
}

当使用触发的 segue Show 调用时,这可以完美无缺地工作。

当我用下面的代码调用 VC 时:

    let storyBoard: UIStoryboard = UIStoryboard(name: "Storyboard", bundle: nil)
    let viewController = storyBoard.instantiateViewController(withIdentifier: "SecondVC") as! SecondVC
self.present(viewController, animated: true, completion: nil)

我从控制台获得了访问 viewDidLoad 和 customizations() 的方法:

called customization() 

但是 navigationItem 没有显示。

试图从调用方法中复制 customization() 中的方法,它们被执行但也没有显示。

知道这里出了什么问题吗?

演示时必须添加导航:

let storyBoard: UIStoryboard = UIStoryboard(name: "Storyboard", bundle: nil)
let viewController = storyBoard.instantiateViewController(withIdentifier: "SecondVC") as! SecondVC
let nav = UINavigationController(rootViewController: viewController)
self.present(nav, animated: true, completion: nil)