I have a class called ModelView that inherits from NSOpenGLView. When my program starts, I attach the ModelView as follows to the main window.
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
ModelView *glView;
NSRect glViewRect = CGRectMake(0.0f, 0.0f, window.frame.size.width, window.frame.size.height);
glView = [[ModelView alloc] initWithFrame: glViewRect];
[[window contentView] addSubview:glView];
}
In my ModelView class, I have a reshape function that runs every time the window is resized
- (void)reshape
{
[super setNeedsDisplay:YES];
[[self openGLContext] update];
NSLog(@"reshap function called");
}
I want to get the width of the main window, so I can resize the ModelView, but I cannot find how to get the width of the window from the ModelView class
I'm new to cocoa / objective-c, so any help is appreciated
source
share