I have a UIViewController with a UIToolbar (on bottom) and I want to add a UINavigationController with UINavigationBar inside. But the UINavigationController is not displayed.
For swift 5
let childNavController = UINavigationController()
parrentVC.addChild(childNavController)
parrentVC.view.addSubview(childNavController.view)
//Add constraints or frame for childNavController here.
childNavController.didMove(toParent: parrentVC)
Adding a view controller as a child view controller isn't enough. You also need to add the navigation controller's view as a subview of the container view controller's view.
[myNav willMoveToParentViewController:self];
myNav.view.frame = navFrame; //Set a frame or constraints
[self.view addSubview:myNav.view];
[self addChildViewController:myNav];
[myNav didMoveToParentViewController:self];
See the View Controller Programming Guide for more details.