当我在Cocoa Touch中更改视图时,我使用此:
GameViewController *game = [self.storyboard instantiateViewControllerWithIdentifier:@"GameViewController"];
game.something = someValue;
game.somethingOther = someOtherValue;
[self presentViewController:game animated:NO completion:^{}];
如何在replaceScene
之前传递此值?
我现在有了这个:
[[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1.0 scene:[GameLayer scene] withColor:ccWHITE]];
答案 0 :(得分:4)
好的,那太容易了......
需要创建方法+(CSScene *)sceneWithParameter:
和方法-(id)initWithParameter:
。在第一种方法中,需要在ClassLayer *layer = [ClassLayer node]
上更改ClassLayer *layer = [[ClassLayer alloc] initWithParameter:]
,然后才能正常工作。