The docs say that the whole subview hierarchy can be created in -loadView. But there’s also this -viewDidLoad method which sounds nice to ovewrite for actually building the hierarchy, when the view loaded. I guess it’s a matter of taste only. But maybe doing so in -viewDidLoad hast the advantage that the view controller already adjusted the frame of the view correctly to accomodate for the status bar or any other kind of bar like tab bar or tool bar?
Share
viewDidLoad is called after the view hierarchy is built. loadView is supposed to build the hierarchy and set the view property if you are not loading from a NIB file.
viewDidLoad is also called after a memory warning if you’re view got unloaded. When you get a memory warning viewDidUnload is called to give you a change to release objects that can be easily recreated in viewDidLoad.
Read the “Subclassing Notes” and “Memory Management” sections of the class description to better understand how it works.