Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Duke Leto

macrumors regular
Original poster
Mar 17, 2008
166
0
I want the user to be able to open a window from another xib file by clicking a button. I created an NSWindowController subclass. It has an open: action connected to the button, its window is connected to the window, and it is the File Owner of the xib containing the window. The open: method calls loadWindow and showWindow:, but the window does not appear.

The problem appears to be that the window variable shows up as 0x0. Why is it nil, and how can I fix it?

P.S.
I know that I have been using this forum as a crutch for what I do not know about development. Please bear with me, as I am coming from iPhone programming - where I insisted on programmatically creating interfaces.
 
How are you initializing the window controller in code? Are you passing it the correct nib name? Oh, and don't call loadWindow (see the docs). You just need to init the controller with the right nib name, and call showWindow:
 
Ooh... you mean to say that Cocoa doesn't magically initialize things after all?

I should have known that Keebler elves weren't magically fixing my code!

Thanks!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.