I\'m trying to figure out from Apple\'s sketchy documentation which method is the best place to be initializing and adding my Views controls to the controller\'s view.
Hmm, Apple's docs seem to be pretty clear, IMHO.
If you create your own root view (the root view of this particular controller's view hierarchy) programmatically, you should create it in -loadView
without calling super
and set the view
property when done. If your view is loaded from a nib, you should not touch -loadView
.
You add custom subviews to the view controller's view or otherwise modify it in -viewDidLoad
. The recommended practice is to create your UILabel and UIWebView in -viewDidLoad
and release them in -viewDidUnload
, setting their references to nil
if you need to keep them in ivars.
Note: -viewDidUnload
is deprecated in iOS 6 and is just not called any more, because UIViewController
no longer purges its view under memory pressure.