I'm learning OnjC and Cocoa. My C is not my strongest point. I am trying to build a simple single window app to teach me about using delegates.
All the app needs to do is keep the window twice as tall as it is wide when it is resized. I have one class (AppController) that has been defined and set as the delegate for the NSWindow.
This is the windowWillResize method
This doesn't compile however as I get this error:'NSSize' has no member named 'Width'.
I don't fully understand what I've done wrong - I thought NSSize was a C struct with 2 variables (height and width).
What do I need to change?
MadDoc
All the app needs to do is keep the window twice as tall as it is wide when it is resized. I have one class (AppController) that has been defined and set as the delegate for the NSWindow.
This is the windowWillResize method
Code:
#import "AppController.h"
@implementation AppController
// Delegate methods
-(NSSize) windowWillResize: (NSWindow *) sender toSize: (NSSize) frameSize
{
// Make sure that the window remains twice as tall as it is wide
NSSize newSize;
newSize.width = frameSize.Width;
newSize.height = frameSize.width * 2;
return newSize;
}
@end
This doesn't compile however as I get this error:'NSSize' has no member named 'Width'.
I don't fully understand what I've done wrong - I thought NSSize was a C struct with 2 variables (height and width).
What do I need to change?
MadDoc