It has come to my attention that if one calls [self view]; or [self window]; within, respectively, an init method of NSViewController or NSWindowController, then all the IBOutlets become available right there in the init method.
Would you regard it a bad programming practice to do so?
For NSWindowController, I suppose it’s better to use the “windowDidLoad” method to guarantee the outlets are connected. But what about NSViewController?
Yes; don’t cause the nib to be loaded unless and until you absolutely need to access any of the objects in the nib. Let the controller be lazy, as it is designed to be.
Override
loadView. Send[super loadView], then do whatever you need to do that requires the view to have been loaded.Edit: As ughoavgfhw notes,
awakeFromNibis also a good choice, possibly even a better one.