On Aug 29, 2011, at 3:51 PM, koko wrote:

> I have created a nib which contains a window. I have set the File's Owner to 
> NSWindowController.
> I have connected the window outlet of File's Owner to the window defined in 
> the nib.

Don’t forget to wire the window’s delegate outlet up to the File’s Owner, too … 
omitting that will cause problems later on.

> I do this:
> NSWindowController *wc = [[NSWindowController alloc] 
> initWithWindowNibName:@"ProjectAdvisor"];
> which returns a value in wc.
> Examining wc shows its _window member as 0x0.
> Would someone please comment on why _window would be nil ... thanks.

Because the nib hasn’t been loaded yet. It’s only loaded on demand, the first 
time the -window method is called.

If there’s stuff you need to do to the window or views before they’re 
displayed, you should put those into a -windowDidLoad method. At this point the 
nib has been loaded and your outlets are hooked up. You might also want to 
re-read the docs on NSWindowController, as this is all covered there.

—Jens_______________________________________________

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