views:

48

answers:

1

I'm sure this is a really simple problem but I am pulling my hair out over it!

I have a subclass of NSWindowController called WinAController. This has been created in IB and is in MainMenu.xib.

I have a separate nib called WinA.xib that contains just a single window. In this nib, I have set the following:

  1. Class of File's Owner to WinAController
  2. The window property of File's Owner to WinA
  3. WinA's delegate to WinAController (which implements the NSWindowDelegate protocol).

I have hooked up a menu item on MainMenu to the -showWindow method of WinAController so that when clicked, WinA should display but nothing happens. It seems that WinAController's window property is not being set.

Where am I going wrong? Do I need to initialise WinAController with WinA.xib at some point in code in order to set this?

Thanks,

A: 

This, called from WinAController, seems to work perfectly:

- (id)init {
// Load our window from the nib
self = [super initWithWindowNibName:@"WinA"];

// Now we're initialised - return us
return self;
}
Garry