addChildViewController alternative for iOS 4.3

前端 未结 3 696
旧时难觅i
旧时难觅i 2021-01-14 17:33

I would like to use the same functionality of addChildViewController, but for the version 4.3 (addChildViewController is only available in version 5). Thanks in advance.

3条回答
  •  醉话见心
    2021-01-14 18:21

    Although it's not recommended, you can create an instance of a UIViewController access it's view property and set it as a subview of the main view your main UIViewController is managing. It works, and I never experienced a problem with this.

    That said, the recommended way is to have a NSObject subclass to act as your sub-controller, and not use a UIViewController as it has special behavior.

提交回复
热议问题