2013-10-25 80 views
-1

我有一個場景,我需要通過雙擊提出了另一個場景,但它簡化版,工作((我在哪裏出錯或我的是,我知道什麼是錯的 該代碼:?的iOS 7:SpriteKit GestureRecognizer

-(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];} 

回答

0

如果我在現場委託的UIView通過:!?

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

它的工作原理=)

+0

嘿,你介意解釋你是怎麼做的我遇到同樣的問題,但不明白你是如何解決它的。謝謝! – Zephyer