使用touchesBegan时如何重置按钮

时间:2014-08-24 04:16:37

标签: ios sprite-kit

当我在我的精灵套装游戏中使用touchesBegan时,按钮第一次按下时很好但第二次没有响应,我该如何重置"这些按钮,如果你愿意。按钮如下:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    UITouch *touch = [touches anyObject];
    CGPoint location = [touch locationInNode:self];
    SKNode *node = [self nodeAtPoint:location];


    if ([node.name isEqualToString:@"Button"]) {

        [self runAction:[SKAction playSoundFileNamed:@"sound" waitForCompletion: NO]];
             GKGameCenterViewController *gameCenterController = [[GKGameCenterViewController       
 alloc]
                                                        init];
        if (gameCenterController != nil)
        {
            gameCenterController.gameCenterDelegate = self;
            gameCenterController.viewState = GKGameCenterViewControllerStateAchievements;
            UIViewController *vc = self.view.window.rootViewController;
           [vc presentViewController: gameCenterController animated: YES completion:nil];
                    }

    }

感谢您的帮助!

0 个答案:

没有答案