I’ve done the exercice where you have to setup a delegate of an NSWINDOW.
My code works well, when the user change the size of the window I contraint it size to W = 2*H
But about setting the delegate of the NSWINDOW. I did this by draging delegate from the window to the app controler in Interface Builder. I didn’t set it in my code
So for exemple in the INIT method, I didn’t write something like this
theWindow = [[NSWINDOW alloc] init];
I’ve tried to not set the delegate in Interface Builder but in the code. But in this case it doesn’t work
I’m not at home so I don’t have my code. but if I remember what I’ve done was :
- setup an IBOUTLET in the header say IBOutlet NSWindow *theWindow;
- then in my INIT method did the code above
So is it ok to define the delegate’s Window using Interface builder only (and so no IBoutlet and no setDelegate in the init) ?
If we need to set it by programation, how we’ll do that (so with a setDelegate in the init) ?
Also. Anywhere we call the init method, so just because I’m curious, when the init method is called, and by who ?
(sorry for my english, I hope you understand what i try to mean)