Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/114.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS 7:SpriteKit手势识别器_Ios_Uigesturerecognizer_Sprite Kit - Fatal编程技术网

iOS 7:SpriteKit手势识别器

iOS 7:SpriteKit手势识别器,ios,uigesturerecognizer,sprite-kit,Ios,Uigesturerecognizer,Sprite Kit,我有一个场景,我需要双击显示另一个场景,但它不起作用((如果我犯了错误,或者我知道出了什么问题? 该守则: -(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];

我有一个场景,我需要双击显示另一个场景,但它不起作用((如果我犯了错误,或者我知道出了什么问题? 该守则:

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

如果通过以下方式在场景中委派UIView:

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

有效!=)

嘿,你介意解释一下你是怎么做到的吗?我遇到了同样的问题,但不明白你是怎么解决的。谢谢!