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.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- how do you prevent page scroll in textarea on mobi
- Custom UITableview cell accessibility not working
相关文章
- Could I create “Call” button in HTML 5 IPhone appl
- Unable to process app at this time due to a genera
- How do you detect key up / key down events from a
- “Storyboard.storyboard” could not be opened
- Open iOS 11 Files app via URL Scheme or some other
- Can keyboard of type UIKeyboardTypeNamePhonePad be
- Can not export audiofiles via “open in:” from Voic
- XCode 4.5 giving me “SenTestingKit/SenTestKit.h” f
Something similar is explained in iOS: different addSubview behavior between iOS 4.3 and 5.0.
I have solved it by adding these lines:
Although it's not recommended, you can create an instance of a
UIViewController
access it'sview
property and set it as a subview of the mainview
your mainUIViewController
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 aUIViewController
as it has special behavior.I assume the reason you want to do this is for ipad application, as Apple state that a single view controller should "generally" (and before ipad existed they stated "always") control a whole screen full of views.
This really only changed with the extra screen real estate of the ipad when Apple made their own container view controller (splitViewController) which ultimately led to Apple allowing us to create our own container view controllers in ios5.
If your app is an iphone app then I (and Apple) would seriously question your need for view controller containment.