I have a NIB file that I load using NSWindowController initWindowNibName. The NIB file contains one NSWindow. It's File's Owner is of class NSWindowController. I've connected the window outlet from File's Owner to the Window.
When I load the NIB, [windowController window] is nil and so is the top level objects array. However, I can still call [windowController showWindow:nil] and successfully show the window.
Something just doesn't seem right here. I've confirmed the connections and the File's Owner are OK. Infact, when I look at the _owner value of the windowController instance in the debugger I see it pointing to itself as I expect.
Any suggestions on what might be going on?
Thanks!
When you say [windowController window]
is nil, how are you determining this? The NIB isn't actually loaded until -window
is called for the first time. So if you're looking in the debugger you'll see _window
as nil until you call showWindow:
. After that, _window
should have a non-nil value.
Have you subclassed NSWindowController?
When I do this, I use an NSWindowController called MyWindowController and call initWithWindowNibName:
in the subclass's init
And then , set File's Owner to point to the MyWindowController class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With