当一个scene中同时有UITapGestureRecognizer和CCMenu,点击时不会响应CCMenu,此时必须对UITapGestureRecognizer进行设置
UITapGestureRecognizer *tapGestureRecognizer =[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTapGestureRecognizer:)]; tapGestureRecognizer.cancelsTouchesInView = NO; [self addGestureRecognizer:tapGestureRecognizer];
cancelsTouchesInView为YES,表示当Gesture Recognizers识别到手势后,会向hit-test view发送 touchesCancelled:withEvent:消息来取消hit-test view对此触摸序列的处理,这样只有Gesture Recognizers能响应此触摸序列,hit-test view不再响应。如果为NO,则不发送touchesCancelled:withEvent:消息给hit-test view,这样会使Gesture Recognizers和hit-test view同时响应触摸序列。