iPhone:如何检测哪次触摸已经结束?
在我的应用程序中,我想检测用户何时松开第二根手指并只在屏幕上握住一根手指。
问题是我的 TouchesEnded:withEvent: 显示 [[event allTouches] count] 为 2。
我如何检测哪一个触摸仍保留在屏幕上?
谢谢。
In my app I want to detect when the user lift off his second finger and is holding only one on the screen.
The problem is that my touchesEnded:withEvent: shows [[event allTouches] count] to be 2.
How can I detect which one of the touches remains on the screen?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当用户进行触摸时,会触发 TouchBegan 方法。您可以将指针保持在出现的第一个触摸处。在触摸结束之前它不会改变。
编辑:
我假设您的类中有一个变量
UITouch *myTouch
来处理触摸事件。When touch is made by user touchesBegan method triggers. You can keep the pointer to the first touch appeared. It will not be changed until the touch ends.
EDIT:
I assume you have a variable
UITouch *myTouch
in your class that handles touch events.