Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You should not implement both <code>-viewDidLoad</code> and <code>-loadView</code>; they are for different purposes. If you load a NIB, you should implement <code>-viewDidLoad</code> to perform any functions that need to be done after loading the NIB. Wiring up the tabbar is appropriate there if you haven't already done it in the NIB.</p> <p><code>-loadView</code> should be implemented if you do not use a NIB, and should construct the view.</p> <p><code>-viewWillAppear</code> is called immediately before you come onscreen. This is a good place to set up notification observations, update your data based on model classes that have changed since you were last on screen, and otherwise get your act together before the user sees you. You should not perform any animations here. You're not on the screen; you can't animate. I see a lot of animation glitches due to this mistake. It kind of works, but it looks weird.</p> <p><code>-viewDidAppear</code> is called after you come onscreen. This is where you do any entry animations (sliding up a modal, for instance; not that you should do that very often, but I was just looking at some code that did).</p> <p><code>-viewWillDisappear</code> is called right before you go offscreen. This is where you can do any leaving animations (including unselecting tableview cells and the like).</p> <p><code>-viewDidDisappar</code> is called after you're offscreen (and the animations have finished). Tear down any observations here, free up memory if possible, go to sleep as best you can.</p> <p>I touch on setting up and tearing down observations here. I go into that in more depth in <a href="http://robnapier.net/blog/view-controllers-notifications-160" rel="nofollow noreferrer">View controllers and notifications</a>.</p>
 

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