On Jan 16, 2009, at 2:06 AM, Alexander Reichstadt wrote:

@implementation KSingleItemSelectorController

#pragma mark -
#pragma mark Init+Dealloc
+ (id)selectItemUsingFenstertyp:(NSString *)aFenstertyp withComposition:(NSString *)aKomposition
{
KSingleItemSelectorController *newXelector = [[self alloc] initWithWindow:nil];

Why are you initializing your window controller with a window, and a nil window at that, rather than with a nib name? If you want the window controller to load the window to be controlled from a nib, tell it to do that directly.

        [...]
}

- (id)initWithWindow:(NSWindow *)aWindow
{
        if ((self = [super initWithWindow:aWindow])){
                [NSBundle loadNibNamed:[self windowNibName] owner:self];
                return self;
        }
        return nil;
}

You don't need to override the initWithWindow: method. The usual pattern with window controller subclasses is to either: 1) don't override any of the initializers (at least not for the purpose of nib loading) and instead have the code with allocates and initializes the object invoke -initWithWindowNibName:, or 2) override plain old -init and have the subclass hard-code the name of the nib it manages when it invokes [super initWithWindowNibName:YourNibName].

Regards,
Ken

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to