Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I was wondering about this question too. I watched <a href="https://developer.apple.com/videos/play/wwdc2011/102/" rel="noreferrer">Session 102 of the WWDC 2011</a> videos and Mr. View Controller, <a href="https://twitter.com/twotothen" rel="noreferrer">Bruce D. Nilo</a>, said this:</p> <blockquote> <p><code>viewWillAppear:</code>, <code>viewDidAppear:</code>, etc have nothing to do with <code>addChildViewController:</code>. All that <code>addChildViewController:</code> does is to say "This view controller is a child of that one" and it has nothing to do with view appearance. When they get called is associated with when views move in and out of the window hierarchy.</p> </blockquote> <p>So it seems that the call to <code>addChildViewController:</code> does very little. The side effects of the call are the important part. They come from the <code>parentViewController</code> and <code>childViewControllers</code> relationships. Here are some of the side effects that I know:</p> <ul> <li>Forwarding appearance methods to child view controllers</li> <li>Forwarding rotation methods</li> <li>(Possibly) forwarding memory warnings</li> <li>Avoiding inconsistent VC hierarchies, especially in <code>transitionFromViewController:toViewController:…</code> where both VCs need to have the same parent</li> <li>Allowing custom container view controllers to take part in State Preservation and Restoration</li> <li>Taking part in the responder chain</li> <li>Hooking up the <code>navigationController</code>, <code>tabBarController</code>, etc properties</li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload