Reputation: 1144
I am presenting a UINavigationController programmatically like this:
let homeViewController = HomeViewController.loadFromNibNamed(nibNamed: "HomeViewController")
let homeNavigationViewController = UINavigationController(rootViewController: homeViewController!)
self.present(homeNavigationViewController, animated: true, completion: nil)
but then in HomeViewController there is a call for self.navigationController!.navigationBar
where the navigationController is nil?
Upvotes: 0
Views: 613
Reputation: 353
Try to print or use self.navigationController?.navigationBar in viewWillAppear().
I think navigationController will be optional.
Upvotes: 4