0

I've got a SpriteKit game running on the Mac, and I want to bring up a NSViewController over it, so I do this:

self = [super initWithNibName:@"Settings-Mac" bundle:nil ];
[gGameViewController.view addSubview:self.view];

According to the debugger, all is well, but I never see the ViewController. However, if I do this it works:

gGameWindow.contentView = self.view;

That little hack to make the ViewController appear eventually causes a crash as I just forced the SpriteKit view out in a very abrupt way.

Any ideas why nothing shows up with addSubview? My -viewDidLoad is being called, and all of the pointers in the self object look legit.

BGreenstone
  • 260
  • 1
  • 11
  • It is rather tricky to add NSView objects on top of an OpenGL context view, such as Sprite Kit. I once solved this for cocos2d, perhaps there are some pointers that help: http://www.learn-cocos2d.com/2013/04/display-nsview-top-cocos2d-iphone-opengl-view-mac/ However it's quite possible that with Sprite Kit you just can't draw an NSView over the SKView. – CodeSmile Sep 03 '14 at 17:40
  • There may also be some pointers here: https://developer.apple.com/library/mac/documentation/graphicsimaging/conceptual/opengl-macprogguide/opengl_pg_concepts/opengl_pg_concepts.html And perhaps this helps and is applicable: http://stackoverflow.com/questions/2221442/nstextfield-over-nsopenglview – CodeSmile Sep 03 '14 at 17:42

0 Answers0