Nick
Nick

Reputation: 3461

When does window becomes initialized in NSWindowController

I'm examining Apple's tutorial OSXGLEssentials. There is a class named GLEssentialsWindowController that inherits NSWindowController. It has method

- (id)initWithWindow:(NSWindow *)window

but argument window is nil.

I have added method

 -(void)windowDidLoad

but it is just not called.

However, at some magic moment field window becomes initialized, because when I press "F" button the app switches from windowed mode to fullscreen and I can see that self.window is not null at this moment.

So my question is: when does window field becomes initialized?

Upvotes: 1

Views: 114

Answers (1)

Jay
Jay

Reputation: 6638

Have you checked whether it's connected in the xib?

One option is to set the window controller as the windows owner using the File Owner proxy. At runtime the outlet will the be connected auto-magically.

And you can always set a watchpoint in Xcode to detect when somebody changes the value of your variable.

Upvotes: 1

Related Questions