我正在使用 UILongPressGestureRecognizer 来跟踪 UIView 内的触摸,这就是我的代码
-(void)tapGes:(UILongPressGestureRecognizer *)tapGesture
{
CGPoint location=[tapGesture locationInView:self.view];
UIView *view=tapGesture.view;
switch (tapGesture.state)
{
case UIGestureRecognizerStateBegan:
NSLog(@"enter");
break;
case UIGestureRecognizerStateEnded:
NSLog(@"ended");
break;
case UIGestureRecognizerStateChanged:
if (location.x>view.frame.size.width ||
location.y>view.frame.size.height)
{
NSLog(@"out");
return;
}
NSLog(@"change");
break;
default:
break;
}
}
当状态 UIGestureRecognizerStateChanged 的触摸离开 UIView 时我想做什么我不再跟踪它,这样我就不会进入状态 UIGestureRecognizerStateEnded 如何实现这一点?