I often see this line of code
[super awakeFromNib]
in the awakeFromNib method in the implementation of a view controller
My understanding is it is telling the super class of this view controller (which would be the window) to awakeFromNib.
Am I right? If so, why do we have to tell the window to awake in the awakeFromNib method of a UIView Controller sub-class?
right so far…
oops – that’s the source of your confusion.
The “super class of the view controller” is
UIViewController. “super” is referring to the base class that your UIViewController sub-class inherits from; it doesn’t have anything to do with the window that encloses your view.So, what this is doing is invoking the default
awakeFromNibimplementation of a basicUIViewController, in addition to whatever you’re doing in your sub-class implementation.