Challenge: Make a Delegate


#1

[code]- (NSSize)windowWillResize:(NSWindow *)sender
toSize:(NSSize)frameSize
{

NSSize mySize = NSMakeSize(2*frameSize.height, frameSize.height);

NSLog(@"window size is now %f and %f", frameSize.width, frameSize.height);
return mySize;

}[/code]

Height is not exactly half of width as seen in the log. It is near about half.


#2

Perhaps this is beyond the scope of the challenge: I’m curious about the behavior when the “maximize button” in the caption bar is clicked. I see the delegate called then, but the return value seems to be ignored: the window goes full screen.

Is there someway to make the maximize behavior still have h = 2 * w (which I’ll conceded isn’t really maximized)?

BTW, I think you want: