views:

436

answers:

2

when overriding the loadView method in UIViewController, should one call [super loadView] in the beginning of the method or at the end of the method? And why?

+1  A: 

Normally you should not call loadView directly. It merely sets your self.view property and is called by the view controller only.
You should call [super loadView] only if you need the view created by your super class, because you want to include it in your decoration view hierarchy or something like that.

nschmidt
A: 

Just to be really sure, you didn't mean viewDidLoad, right? Because they are two very different methods... as of 3.0, the docs reccomend always calling viewDidLoad at the start.

You can call it either before or after, but usually it is placed at the end unless you have a reason to do otherwise.

Kendall Helmstetter Gelner