-1

我有一个场景,我需要通过双击呈现另一个场景,但它不起作用((我在哪里犯错或者我知道有什么问题?那个代码:

-(id)initWithSize:(CGSize)size {
if (self = [super initWithSize:size]) {
    /* Setup your scene here */

    self.backgroundColor = [SKColor colorWithRed:0.15 green:0.15 blue:0.3 alpha:1.0];

    SKLabelNode *myLabel = [SKLabelNode labelNodeWithFontNamed:@"Chalkduster"];

    myLabel.text = @"Kill Them All!";
    myLabel.fontSize = 30;
    myLabel.position = CGPointMake(CGRectGetMidX(self.frame),
            CGRectGetMidY(self.frame));
    myLabel.alpha = -2;
    SKAction *fadeIn = [SKAction fadeInWithDuration:9.0];
    [myLabel runAction:fadeIn];
    [self addChild:myLabel];


    UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap)];
    doubleTap.numberOfTapsRequired = 2;

    [self.view addGestureRecognizer:doubleTap];
}
return self;}

-(void)doubleTap{
NewScene *newScene = [[NewScene alloc] initWithSize:self.view.bounds.size];
SKTransition *doors = [SKTransition doorsOpenVerticalWithDuration:1.0];
[self.view presentScene:newScene transition:doors];}
4

1 回答 1

0

如果我通过以下方式在我的场景中委托 UIView:

-(id)initWithSize:(CGSize)size andWithView:(UIView *)view

有用!=)

于 2013-10-25T14:15:02.947 回答