I have a CCGLView which is created in Interface Builder. I have a root Navigation Controler onto which I’m pushing a custom UIViewController. When this UIViewController loads, I wire up my CCGLView in viewDidLoad, and everything works – I can interact with my scene.
When I pop my viewcontroller with the back button, then attempt to load it again, the space where my scene should appears just black. Am I missing something?
This is how I set the scene and view for the director:
- (void)viewDidLoad
{
[super viewDidLoad];
CCDirector *director = [CCDirector sharedDirector];
[director setAnimationInterval:1.0/60];
[director setView:glView]; // glView declared/typed in IB
CCScene *scene = [CCScene node];
[scene setContentSize:self.glView.frame.size];
scene.position = ccp(0,0);
self.storySceneLayer = [StorySceneLayer node]; // Create the scene that contains our game world
self.storySceneLayer.delegate = self;
[scene addChild: self.storySceneLayer];
[director pushScene:scene];
[director runWithScene:scene];
[director startAnimation];
This was related to another issue, to which @gmogames posted a solution at https://stackoverflow.com/a/11077131/30512