Add UINavigationController inside UIViewController

前端 未结 2 956
旧巷少年郎
旧巷少年郎 2021-02-15 15:55

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.

2条回答
  •  我在风中等你
    2021-02-15 15:59

    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)
        
    

提交回复
热议问题