Never take the initiative to call the loadView MethodViewController calls loadView when the view attribute is requested and the current view is nil.
If you use xib to create a view and initialize ViewController, it means you need to use the initWithNibName: bundle: method. Do not overwrite the loadView method.
If you create a view manually, overwrite the method.
Never use [super loadView] When overwriting the loadView MethodThe loadView method is to check whether you have wood or xib, and then use xib to load the basic information. If you have wood or xib, a blank UIView is created and used as the view of the ViewController.
So when you override this function, you can implement it in this way. It makes no sense that you do not create a blank UIView. When creating a UIView you want, you must note that this UIView instance must be exclusive to this ViewController (not shared by other instances). Otherwise, problems may occur.
Instantiate the view in loadView and customize the view in viewDidLoad.You only need to create a view during loadView and do not customize it.
When the memory is insufficient, the program will call viewDidUnload to release the memory. This method is opposite to viewDidLoad. When the ViewController is used and the program memory is not so tight, viewDidLoad is called again.
The operations in viewDidLoad and viewDidUnload are relative.
When to execute loadView and viewDidLoadGenerally, the two methods are executed when the ViewController is set to visible. I will explain it further and introduce it later.
ReferenceHttp://my.oschina.net/amoyai/blog/90261
Reprinted please indicate the blog from laruence: http://prevention.iteye.com