我有 4 个手势识别器用于 1 个视图。
- (void)createGestureRecognizers {
UITapGestureRecognizer *singleFingerSingleTap = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(handleSingleFingerSingleTap:)];
singleFingerSingleTap.numberOfTapsRequired = 1;
[self.panelController.view addGestureRecognizer:singleFingerSingleTap];
UITapGestureRecognizer *singleFingerDoubleTap = [[UITapGestureRecognizer alloc]
initWithTarget:self action:@selector(handleSingleFingerDoubleTap:)];
singleFingerDoubleTap.numberOfTapsRequired = 2;
[self.panelController.view addGestureRecognizer:singleFingerDoubleTap];
[singleFingerSingleTap requireGestureRecognizerToFail:singleFingerDoubleTap];
[singleFingerSingleTap release];
[singleFingerDoubleTap release];
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc]
initWithTarget:self action:@selector(handlePanGesture:)];
[self.panelController.view addGestureRecognizer:panGesture];
[panGesture release];
UIPinchGestureRecognizer *pinchGesture = [[UIPinchGestureRecognizer alloc]
initWithTarget:self action:@selector(handlePinchGesture:)];
[self.panelController.view addGestureRecognizer:pinchGesture];
[pinchGesture release];}
我需要处理 UIPinchGestureRecognizer 的结束状态,但有时它的最后一个状态已更改,而不是应如何结束。有人知道为什么吗?我尝试玩 setDelaysTouchesEnded: 但没有:(