HappyCoding:] ChildhoodAndy

思维世界的发展,在某种意义上说,就是对惊奇的不断摆脱。——爱因斯坦

Posts match “ scene ” tag:

Cocos2d重新加载当前场景

| Comments

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

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

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

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

或者:

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