2

The navigation bar do not appear, when choose this line of code

  self.present(vc, animated: true, completion: nil)

But when tried this code

let vc = storyboard.instantiateViewController(withIdentifier: "view")
let navController = UINavigationController(rootViewController: vc)
self.present(vc, animated: true, completion: nil)

My app crashes, giving an error

NSInvalidArgumentException', reason: 'Application tried to present modally an active controller 

Please help me to get navigation bar when presenting a view and not pushing it

cole
  • 3,147
  • 3
  • 15
  • 28

1 Answers1

3

Try doing this -

self.present(navController, animated: true, completion: nil)
Nikhil Manapure
  • 3,748
  • 2
  • 30
  • 55