0
我必須使用定義的UIViewController重新啓動在cocos2d中創建的場景。我怎樣才能做到這一點?請讓我知道我可以做到這一點。如何使用UIViewController重新啓動cocos2d中的場景
我必須使用定義的UIViewController重新啓動在cocos2d中創建的場景。我怎樣才能做到這一點?請讓我知道我可以做到這一點。如何使用UIViewController重新啓動cocos2d中的場景
,你可以嘗試調用像
- (void) restart
{
[[CCDirector sharedDirector] replaceScene:[[self class] node]];
}
我認爲,它會工作,但它是不好的。恕我直言,要好得多使用像這樣的版本
- (void) restart
{
// remove all your content
[self removeAllChildrenWithCleanup];
// reinitialize your instances
// re-add content again
[self addContent];
}
謝謝。 'replaceScene:[[self class] node]];'工作。 – Dalinaum 2013-04-07 07:49:53