Should [super loadView] be called from loadView or not?
In Programming iOS 4 by Matt Newburg he states: "To provide a UIViewController with a view manually, implement its loadView method... You must NOT call super".
In the iOS 5 Developer's Cookbook by Erica Sadun she states: "The loadView method allows you to set up the screen and layout any subviews ....Make sure to call [super loadView] whenever you inherit from a specialized subclass such as UITableViewController or UITabBarController."
This, to me at least, is confusing.
Apple is the source of truth and they say NO super call.
If you override this method in order to create your views manually, you should do so and assign the root view of your 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.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html
[edit]
Another important note scattered around in the UIViewController class reference:
The default loadView method attempts to load the view from the nib file associated with the view controller (if any).
链接地址: http://www.djcxy.com/p/57302.html上一篇: C ++输入性能