我已将以下手势识别器添加到视图中:
UIPinchGestureRecognizer *pch= [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(ViewPinching:)];
[[self view] addGestureRecognizer:pch];
// and
UIPanGestureRecognizer *d = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(ViewDragging:)];
[d setMinimumNumberOfTouches:4];
[[self view] addGestureRecognizer:d];
我想在拖动 4 个手指时触发事件,并且当我这样做时,会触发 Pinch 手势识别器而不是 Pan 手势识别器。我在想,如果我限制 UIPinchGestureRecognizer 仅在 touches.count=2 时被触发,也许我可以解决这个问题
编辑
我不知道这是否实用。也许我可以补充:
UIPinchGestureRecognizer *pch= [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(ViewPinching:)];
[[self view] addGestureRecognizer:pch];
每次触摸开始时,如果有两次触摸,我将添加该事件并将其删除。