I have noticed code from other sources where the author has not added the messages to super that are shown below. I usually add them both, but I was just curious as to what
I would recommend always send UIViewController
delegate messages to super
(e.g. viewDidLoad
, viewDidAppear
). In some cases, it is unnecessary, if you are subclassing UIViewController
directly for example.
Some classes, e.g. UITableViewController
, require subclasses to do that, as it is documented: "You may override loadView or any other superclass method, but if you do be sure to invoke the superclass implementation of the method, usually as the first method call."
The call to super
gives the super class a chance to handle the event (e.g. reload the table data, animate the de-selection of the button, etc).
Needless to say, you don't need an explicit method whose sole job is calling super.