iOS Nested View Controllers view inside UIViewController's view?

前端 未结 3 998
失恋的感觉
失恋的感觉 2020-12-02 05:09

Is it typically bad programming practice in iOS to have a nested view controller\'s view inside UIViewController\'s view? Say for instance I wanted to have some kind of inte

3条回答
  •  囚心锁ツ
    2020-12-02 05:38

    Here is my Swift 3 solution based on Swift Developers On FB's answer

     let childViewController = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "ChildPageViewController"),
     self.addChildViewController(childViewController)
     self.view.addSubview(childViewController.view)
     childViewController.didMove(toParentViewController: self)
    

提交回复
热议问题