Should [super loadView] be called from loadView or not?

In Matt Newburg's iOS 4 programming, he states: "To provide a UIViewController with a view manually, execute its loadView method ... You DO NOT have to call super."

In Erica Sadun's iBook 5 Developer Cookbook, she states: "The loadView method allows you to customize the screen and layout of any subzones .... Be sure to call [super loadView] whenever you inherit from a specialized subclass such as UITableViewController or UITabBarController."

This, at least for me, is confusing.

+7
source share
1 answer

Apple is the source of truth, and they say it's not a super challenge.

If you override this method to manually create your views, you must do this and assign the root view of your hierarchy to view the property. (The views you create must be unique instances and should not be used in conjunction with any other view controller object.) Your custom implementation of this method should not be called super.

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html

[edit]

Another important note scattered around the link of the UIViewController class:

By default, the loadView method tries to load the view from the tip of the file associated with the view controller (if any).

+4
source

All Articles