loadView

先看看文档给的注释:

Creates the view that the controller manages.You should never call this method directly. 
The view controller calls this method when its view property is requested but is currently nil. This method loads or creates a view and assigns it to the view property.If the view controller has an associated nib file, this method loads the view from the nib file. A view controller has an associated nib file if the nibName property returns a non-nil value, which occurs if the view controller was instantiated from a storyboard, if you explicitly assigned it a nib file using the initWithNibName:bundle: method, or if iOS finds a nib file in the app bundle with a name based on the view controller'€™s class name. 
If the view controller does not have an associated nib file, this method creates a plain UIView object instead.If you use Interface Builder to create your views and initialize the view controller, you must not override this method.You can override this method in order to create your views manually. If you choose to do so, assign the root view of your view hierarchy to the view property. 
The views you create should be unique instances and should not be shared with any other view controller object. Your custom implementation of this method should not call super.
If you want to perform any additional initialization of your views, do so in the viewDidLoad method.   

这个接口是让我们自定义controller的view使用的,永远不要主动调用这个函数。view controller会在view的property被请求并且当前view值为nil时调用这个函数。如果你手动创建view,你应该重载这个函数。如果你用IB创建view并初始化view controller,那就意味着你使用initWithNibName:bundle:方法,这时,你不应该重载loadView函数。

这个方法的默认实现是这样:先寻找有关可用的nib文件的信息,根据这个信息来加载nib文件,如果没有有关nib文件的信息,默认实现会创建一个空白的UIView对象,然后让这个对象成为controller的主view。 所以,重载这个函数时,你也应该这么做。并把子类的view赋给view属性(property)(你create的view必须是唯一的实例,并且不被其他任何controller共享),而且你重载的这个函数不应该调用super。(好像调用了super也没什么什么问题,这里不知道为什么不让调用super) 。如果仅仅是想要在当前view上增加一些UIButton或是UILabel,应该在viewDidLoad里去做,此时不要实现自己的loadView。

如果你要进行进一步初始化你的views,你应该在viewDidLoad函数中去做。在iOS 3.0以及更高版本中,你应该重载viewDidUnload函数来释放任何对view的引用或者它里面的内容(子view等等)。

loadView 中通常这样使用

UIView *view = [[UIView alloc] init...];
...
[view addSubview:whatever];
[view addSubview:whatever2];
...
self.view = view;
[view release]; 

viewDidLoad

这个函数在controller加载了相关的views后被调用,而不论这些views存储在nib文件里还是在loadView函数中生成。而多数情况下是做nib文件的后续工作。

这里github上有篇讨论:

iPhone SDK: what is the difference between loadView and viewDidLoad?