例如,我有一个需要两种不同手势的视图:
点击执行操作 A. 双击执行操作 B.
问题在于 UITapGestureRecognizer 我只能设置所需的最少点击次数。在双击手势识别器识别双击之前,单击手势识别器识别点击。
例子:
_tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGestureRecognized:)];
_tapGestureRecognizer.numberOfTouchesRequired = 1;
_tapGestureRecognizer.numberOfTapsRequired = 1;
[self addGestureRecognizer:_tapGestureRecognizer];
_doubleTapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTapGestureRecognized:)];
_doubleTapGestureRecognizer.numberOfTouchesRequired = 1;
_doubleTapGestureRecognizer.numberOfTapsRequired = 2;
[self addGestureRecognizer:_doubleTapGestureRecognizer];
即使我非常快速地双击它,它也总是能识别单击。如何设置它以便轻按手势识别器等待并查看双击手势识别器是否识别?