我正在使用两种不同的 TapGestureRecognizer 来处理屏幕上的单击和双击。这是代码:
UITapGestureRecognizer *tapGR =[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleTap:)];
[tapGR setDelegate:self];
[tapGR setNumberOfTapsRequired:1];
[self addGestureRecognizer:tapGR];
UITapGestureRecognizer *doubleTapGR = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(handleDoubleTap:)];
[doubleTapGR setNumberOfTouchesRequired:2];
[self addGestureRecognizer:doubleTapGR];
[tapGR requireGestureRecognizerToFail : doubleTapGR];
[tapGR release];
[doubleTapGR release];
即使我指定了 [tapGR requireGestureRecognizerToFail: doubleTapGR],也会执行“handleTap”选择器。错误在哪里?