我有一个 UIView,我想知道用户何时在做什么:
touchDownInside
(突出显示 View )
touchUpInside
(确认操作)
touchUpOutside
(取消并重置突出显示)
什么gestureRecognizer可以为我做到这一点?
最佳答案
请仔细阅读您的 View 也可以重写的这四种方法来处理四种不同的触摸事件:
1)一个或多个手指触摸屏幕
-(void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event;
2)手指在屏幕上移动(手指移动时会重复此消息。)
-(void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event;
3)手指离开屏幕
-(void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event;
4) 系统事件,在触摸结束之前中断触摸
-(void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event;
关于iphone - UIGestureRecognizer 在 targetView 外部触摸时取消,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9315117/