Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>All these commands are called automatically at the appropriate times by iOS when you load/present/hide the view controller. It's important to note that these methods are attached to <code>UIViewController</code> and not to <code>UIView</code>s themselves. You won't get any of these features just using a <code>UIView</code>.</p> <p>There's great documentation on Apple's site <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html" rel="noreferrer">here</a>. Putting in simply though:</p> <ul> <li><p><code>ViewDidLoad</code> - Called when you create the class and load from xib. Great for initial setup and one-time-only work.</p></li> <li><p><code>ViewWillAppear</code> - Called right before your view appears, good for hiding/showing fields or any operations that you want to happen every time before the view is visible. Because you might be going back and forth between views, this will be called every time your view is about to appear on the screen.</p></li> <li><p><code>ViewDidAppear</code> - Called after the view appears - great place to start an animations or the loading of external data from an API.</p></li> <li><p><code>ViewWillDisappear</code>/<code>DidDisappear</code> - Same idea as <code>ViewWillAppear</code>/<code>ViewDidAppear</code>.</p></li> <li><p><code>ViewDidUnload</code>/<code>ViewDidDispose</code> - In Objective C, this is where you do your clean-up and release of stuff, but this is handled automatically so not much you really need to do here.</p></li> </ul>
 

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