I'm trying to programmatically create a window with my own custom OpenGL NSView as it's view, but I'm having a problem with ARC destroying my view. This is the code I'm using now:
[_window setContentView:[[MyOpenGLView alloc] init]];
MyOpenGLView
is just an NSView
where I handle all my OpenGL calls. I set up OpenGL in my initWithFrame:(NSRect)
and then return myself. I can step through that code and it works correctly. The problem is that as soon as the setContentView
gets called, my newly allocated MyOpenGLView
gets autoreleased. Is there a way to make the window retain the view?