按后退按钮后导航栏不隐藏

navigation bar is not hidden after pressing back button

当我执行 segue 时 self.performSegue(withIdentifier: "GoToClientScreen", sender: nil) 然后我单击导航栏中的后退按钮然后在我的主屏幕导航栏中未隐藏

主屏幕代码 ->

   @IBAction func nextBtn(_ sender: UIButton) {
    self.performSegue(withIdentifier: "GoToClientScreen", sender: nil)
    }

客户端屏幕代码 ->

 override func viewDidLoad() {
    super.viewDidLoad()
    self.navigationController?.setNavigationBarHidden(false, animated:  true)
 }

见图->

打开应用程序然后按下一步

然后在此处按返回按钮我想要导航栏

并且导航栏没有隐藏

在第一个屏幕上隐藏导航栏。

在ViewWillAppear方法中,编写如下代码。

self.navigationController?.setNavigationBarHidden(true, animated: false)

这将解决此问题。