I show modal subclassed window:
NSWindowController* controller = [[NSWindowController alloc] initWithWindowNibName: @"MyWindow"];
[NSApp runModalForWindow: [controller window]];
And I override initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag in my window subclass to setup children views which are linked to nib file. But these children are not initialized at this moment (are nil).
Where to place my initialization code?
The nib/xib loader creates the objects (with some of the constructrors from
initfamily) and setups their outlets in an undefined order. After they all exists and all the outlets are set up, then it sendsawakeFromNibto all objects from nib/xib files (which accept this message) so this is the right place where to perform most of the initialization.