0
votes

I'm starting the game with a UIViewController in this way:

navController = [[MyNavigationController alloc] initWithRootViewController:myController];

and when you push the game button the game start the scene in this way:

[[CCDirector sharedDirector] runWithScene:gameScene];

ok, now when I want to quit I just replace the UIViewController (because I did the menu with UIKit and the game with cocos2d) with the starting view controller to do the animation I want, it works fine... but obviously the old running scene still remains in memory, it is not deallocated in any way, I need to remove the scene and make the app as it was at the first running.

The replaceScene didn't work, I just need to stop the running scene and make everything as it was when the app started running, from the [CCDirector sharedDirector] direcly, how can I do it? popScene won't work too.

1
load an empty scene and call director's stopAnimationLearnCocos2D
I can't load an empty scene, I need to switch between the current scene and the UIViewController (which is working), I've tried to stopAnimation and to call [[CCDirector sharedDirector] end]; the scene is ended but when I call another game scene nothing happensAdarkuccio
you have to call startAnimation then. Isn't your uiviewcontroller fullscreen?LearnCocos2D

1 Answers

0
votes

you can remove the CCDirector from the application.

the director is a simple UIViewController so, you can call

[[CCDirector sharedDirector] removeFromParentViewController];

and after call the [[CCDirector sharedDirector] end]; to remove the singlenton instance