iphone - UIGestureRecognizer 在 targetView 外部触摸时取消

标签 iphone objective-c ios uigesturerecognizer uitouch

我有一个 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/

相关文章:

objective-c - INAppStoreWindow 标题栏上的 NSSplitView 分隔符

ios - ASIHTTPRequest加载数据时如何使用UIActivityIndi​​catorView?

ios - 连接到 iOS 中需要用户名和密码的 JSON API

javascript - CSS:用于触摸屏逆向工程的悬停

android - 谷歌地图启动链接,源地址为 "Current Location"

ios - 覆盖iOS音频输出

html - 在 iphone 上使用 html/css 输入焦点问题

ios - MBProgressHUD 更新进度

ios - 将方法分组到 Objective-C 类别中

ios - 使用iOS Facebook SDK 3.1在墙上张贴