在我的应用程序中,我必须检测单次、两次和三次点击。所以,我正在使用 UITapGestureRecognizer。我正在使用以下代码:
UITapGestureRecognizer *oneTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleSingleTapGestureOnAnimal:)];
oneTap.numberOfTapsRequired = 1;
UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTapGestureOnAnimal:)];
doubleTap.numberOfTapsRequired = 2;
[doubleTap requireGestureRecognizerToFail:oneTap];
UITapGestureRecognizer* tripleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTripleTapGestureOnAnimal:)];
tripleTap.numberOfTapsRequired = 3;
[tripleTap requireGestureRecognizerToFail:doubleTap];
[self addGestureRecognizer:oneTap];
[self addGestureRecognizer:doubleTap];
[self addGestureRecognizer:tripleTap];
但问题是它总是只检测单击和双击。它根本没有检测到三次点击....有人可以指出我在检测三次点击时所犯的错误吗?