在Cocos2d v3中解散UIAlertView之后没有调用touchesBegan

时间:2014-12-06 05:33:46

标签: objective-c cocos2d-iphone uialertview

在我的CCScene中显示并解除UIAlertView后,touchBegan停止响应。 CCButton仍然会响应触摸,如果我在解雇UIAlertView touchBegan后再点击CCButton再次开始工作。

这是touchBegan,在我按下CCButton之前没有注册触摸,直到我按下CCButton

-(void) touchBegan:(UITouch *)touch withEvent:(UIEvent *)event {

    CGPoint touchLoc = [touch locationInNode:self];

        NSLog(@"touchBegan");

}

创建UIAlertView

- (void)showAlert {

    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Name" message:@"Enter Name" delegate:self cancelButtonTitle:@"Done" otherButtonTitles:nil];
    [alert setTag:1];
    alert.alertViewStyle = UIAlertViewStylePlainTextInput;
    [alert show];

}

警报被驳回

- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex (NSInteger)buttonIndex
{

    if (alertView.tag == 1) {

        UITextField *textField = [alertView textFieldAtIndex:0];
        player.name = textField.text;

    }
}

使用ccTouchBegan在cocos2d v2.x下这种类型的东西似乎工作正常。我错过了什么?

0 个答案:

没有答案