Newbie: setting a delegate to NSWindow
Newbie: setting a delegate to NSWindow
- Subject: Newbie: setting a delegate to NSWindow
- From: Aaron Vegh <email@hidden>
- Date: Wed, 9 Mar 2005 22:21:56 -0500
Hi there,
I'm just starting to learn Cocoa using Hillegas' 2nd Edition as my
primary source. I'm up to the end of chapter 5 now and trying to do
the Challenge. We're asked to produce a simple app that is a single
window which maintains a 2:1 aspect ratio as the user resizes it.
We're asked to use the (NSSize)windowWillResize delegate method.
This seemed fairly straightforward until I tried it, and the darned
thing won't work! I'm hoping someone here will take pity on me and
just point me in the right direction.
I start with an AppController subclass of NSObject, and in its init
method I have this code:
- (id)init
{
[super init];
theWindow = [[NSWindow alloc]init];
[theWindow setDelegate:self];
return self;
}
and then I have the delegate method:
- (NSSize)windowWillResize:(NSWindow *)sender
toSize:(NSSize)frameSize
{
NSLog(@"window has been resized");
}
I just want to have the fact that the delegate method is being called
logged. Trouble is, the method is never fired, and I don't know why!
Part of my problem here is that this is the only help resource I can
find. I know I'm playing well under the league of everyone else here,
but I don't know where else to go. Some suggestions along that line
would also be useful, because I don't want to be bothering all of you
with my growing pains. :-)
Thanks for your help!
Aaron.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden