在我的代码中,我将手势添加到数组中。那就是我提到的:
- (void)handlePanGesture:(UIPanGestureRecognizer *)panGestureRecognizer{
[arrayLineGestures addObject:panGestureRecognizer];
[arrayAllGestures addObject:[arrayLineGestures copy]];
}
所以一段时间后我想再次使用它们并使用以下代码:
for (int i=0; i<[arrayAllGestures count]; i++) {
for (int k=0;k<[[arrayAllGestures objectAtIndex:i]count]; k++) {
UIPanGestureRecognizer *panGestureRecognizer=(UIPanGestureRecognizer *)[[arrayAllGestures objectAtIndex:i]objectAtIndex:k];
const CGPoint point = [[CCDirector sharedDirector] convertToGL:[panGestureRecognizer locationInView:panGestureRecognizer.view]];
if (panGestureRecognizer.state == UIGestureRecognizerStateBegan) {Nslog(@"began")}
但是这段代码不起作用。它将 pangesture 状态显示为 UIGestureRecognizerStatePossible。但在我将它们添加到数组之前,我检查了没有人是 UIGestureRecognizerStatePossible 的状态。我看不到错误。
谢谢。