Re: Newbie: Getting an NSWindow and setting its delegate
Re: Newbie: Getting an NSWindow and setting its delegate
- Subject: Re: Newbie: Getting an NSWindow and setting its delegate
- From: Martin Linklater <email@hidden>
- Date: Sat, 30 Jul 2005 16:40:24 +0100
Hi,
You are probably thinking way to complicated ;-) I'm just going
through the book myself, so as a help for you and a reminder for
me, here's how I did it. Of course, I'm not a Cocoa pro, but I
think it is a correct way to do it.
Cool. Although I got it working with a lot less code than your
example. I'm not sure if I've done something horrendous but my
solution was a bit simper.
- Create simple Cocoa project in XCode.
- Double click the NIB - CTRL-drag from the Window instance to the
AppController instance - connect the delegator.
Then simply add this function declaration and definition to
AppController.h /.m respectively:
*** add to AppController.h
- (NSSize)windowWillResize:(NSWindow *)sender
toSize:(NSSize)frameSize;
*** add to AppController.m
- (NSSize)windowWillResize:(NSWindow *)sender
toSize:(NSSize)frameSize
{
frameSize.width = frameSize.height / 2;
return frameSize;
}
Then when I resize the Window the size is snapped to be twice as high
as it is wide. Am I missing anything important by not including all
the IBOutlet stuff that is present in your code ?
_______________________________________________
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