Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie: Getting an NSWindow and setting its delegate



Well, functionally, obviously not. But the challenge is "Create a new Application with one window. Create an object that is a delegate of the window. As the user resizes the window, make sure .....".

Again, I'm new to this too, but I think you skipped the "create an object" part.


Am 30.07.2005 um 17:40 schrieb Martin Linklater:

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: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Newbie: Getting an NSWindow and setting its delegate (From: Martin Linklater <email@hidden>)
 >Re: Newbie: Getting an NSWindow and setting its delegate (From: Michael Ströck <email@hidden>)
 >Re: Newbie: Getting an NSWindow and setting its delegate (From: Martin Linklater <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.