Reputation: 3357
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
Upvotes: 2
Views: 144
Reputation: 3878
Try doing this -
self.present(navController, animated: true, completion: nil)
Upvotes: 3