I'm in chapter 6 of Hillegass's Cocoa book and working on the first challenge. It would have been easier if he provided how to get the window size (figured it out eventually). Here's my .m file:
When I try to resize the window I can't. I'm getting in my log I'm hitting this code. All I'm trying to do is keep a constant aspect ratio of 2 to 1 using this method. I've delegated to my .m object from the window. What I think is happening is that when I grab the corner to resize I'm stuck with both sizes as they are. I know this is something really easy to fix. I've been on this for an hour and could use a nudge. Thanks again!
Sean
Code:
@implementation WindowController
-(NSSize)windowWillResize:(NSWindow *)sender
toSize:(NSSize)framesize;
{
NSSize currentSize = [sender frame].size;
framesize.width =currentSize.width;
framesize.height =currentSize.width * 2;
NSLog(@"framesize is %f wide and %f tall", framesize.width, framesize.height);
return framesize;
}
When I try to resize the window I can't. I'm getting in my log I'm hitting this code. All I'm trying to do is keep a constant aspect ratio of 2 to 1 using this method. I've delegated to my .m object from the window. What I think is happening is that when I grab the corner to resize I'm stuck with both sizes as they are. I know this is something really easy to fix. I've been on this for an hour and could use a nudge. Thanks again!
Sean