I have a window contained in a nib file that gets loaded by a custom subclass of NSWindowController like this:
- (id)init
{
self = [super initWithWindowNibName:@"MyWindow"];
return self;
}
I’d like to initialize the views in this window before it becomes visible. Right now I’m reading some User Defaults and setting the window’s views in windowDidLoad. But unfortunately, the newly initialized values are applied only after the window has become visible, resulting in the uninitialized values flashing very briefly.
windowWillLoad doesn’t work as the window has not been loaded from the nib file yet at that point.
How can I initialize the window before it is displayed?
- (void)awakeFromNibis a very good place to do view setup. It is called after all objects have been de-archived and outlets have been connected.More info in the documentation