Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 403
Luis Andrés García Avatar asked May 25 '26 12:05

Luis Andrés García


1 Answers

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.

like image 103
pgb Avatar answered May 28 '26 01:05

pgb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!