Cocos2d重新加载当前场景

在cocos2d中如何重新加载当前场景?

1
CCScene *currentScene = [[CCDirector sharedDirector]runningScene];
[[CCDirector sharedDirector]replaceScene:currentScene];

上面的方法肯定不对啦
更改如下:

1
[[CCDirector sharedDirector] replaceScene:[YourSceneClass scene]];

或者:

1
CCScene *currentScene = [CCDirector sharedDirector].runningScene;
CCScene *newScene = [[[currentScene class] alloc] init];
[[CCDirector sharedDirector] replaceScene:newScene];

坚持原创技术分享,您的支持将鼓励我继续创作!