呈现ViewController时导航栏不显示

问题描述 投票:0回答:1

我显示带有以下代码的UIViewController

self.performSegue(withIdentifier: "myControllerSegue", sender: nil)

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        if segue.identifier == "myControllerSegue", let viewController = segue.destination as? myViewController {
            viewController.modalPresentationStyle = .fullScreen
        }
    }

在MyViewController中,我编写了以下代码

 override func viewWillAppear(_ animated: Bool) {
         super.viewWillAppear(animated)
             navigationController?.setNavigationBarHidden(true, animated: animated)
             //navigationController?.setNavigationBarHidden(false, animated: animated)

     }

     override func viewWillDisappear(_ animated: Bool) {
         super.viewWillDisappear(animated)
             navigationController?.setNavigationBarHidden(false, animated: animated)
             //navigationController?.setNavigationBarHidden(true, animated: animated)
     }

导航栏仍未显示。您对这个问题有想法吗?

ios swift uiviewcontroller uinavigationcontroller
1个回答
-2
投票
© www.soinside.com 2019 - 2024. All rights reserved.