On a UIViewController instantiated by a UITabBarController, when I run the following code,
let destination = self.storyboard?.instantiateViewControllerWithIdentifier("test")
self.navigationController!.pushViewController(destination!, animated: true)
navigationController
return nil. How can I get navigationController
instance to push a view controller?
As @Paulw11 said, what was missing was embed the UIViewController
in a navigation controller. To do that, drag-and-drop a Navigation Controller
to the Storyboard and CTRL + drag from that Navigation Controller
to the UIViewController
, chosing the relationship root view controller
.