To form a parent-child relationship:
- Send the
-addChildViewController:message to the parent with the child as the parameter. This will send the-willMoveToParentViewController:message to the child with the parent as the parameter. - Add the child view controller's
viewas a subview to the parent view controller'sview. - Send the
-didMoveToParentViewController:message to the child with the parent as the parameter.
For example,
[parent addChildViewController:child];