iOS 5
introduces the concept of custom container view controller and provides API like addChildViewController
. Question: can you add a view controller as a child and still present it using presentViewController
? Does doing the latter automatically make it a child view controller of the presentingViewController
?
相关问题
- what is the difference between bounded and unbound
- didSelectViewController method not being called (w
- ios5 background management different from ios4?
- CoreBluetooth - Can connectPeripheral be called mu
- Dismiss ChildView From ParentViewController
相关文章
- Popover segue to static cell UITableView causes co
- Creating UIImage from CIImage
- How to set different navigationbar color for diffe
- How to open Photo app from UIViewController?
- Custom transition animation unknown delay between
- Presenting a View Controller with a button in a UI
- iPad modal form sheet takes up the whole screen an
- UIAlertViewStylePlainTextInput return key delegate
That's not how it's supposed to be used.
The parent/child relationship is for when a view controller has subviews that are managed by their own view controllers, for example a UITabBarController, where the parent view controller draws the tabs and the child view controllers draw the content of each tab.
If you present a view controller using presentViewController, it generally takes over the whole screen, or appears in a modal so that the presenting view controller is no longer in control. In that scenario there's no reason for the presenter to be the parent because it doesn't need to cooperate with the presented controller - it just gets out of the way until the presented controller is dismissed again.
Why is it that you wanted to do this? If it's just so that the view controllers have a reference to one another and can pass data, there are other ways to do this (e.g. the delegate pattern, NSNotifications, or even just a property linking the two).