One Quickie

Force an NSWindowController's nib to be loaded (NSWindow->General)
The window controller nib doesn't get loaded until the window is manipulated. This can cause confusion if you do any kind of setup before the window is shown. If you call the window method, that will force the nib file to be loaded. Something like this:
+ (BWInspector *) sharedInspector
    static BWInspector *s_inspector;

    if (s_inspector == nil) {
        s_inspector = [[BWInspector alloc]
                          initWithWindowNibName: @"BWInspector"];
        assert (s_inspector != nil);

        // force loading of nib
        (void) [s_inspector window];

    return (s_inspector);

} // sharedInspector

borkware home | products | miniblog | rants | quickies | cocoaheads
Advanced Mac OS X Programming book