Search code examples
iphoneversionaddchild

addChildViewController alternative for iOS 4.3


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.


Solution

  • 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.