滑动手势和绘制用户触摸错误
我有 UISwipeGestureRecognizer 可以检测用户是否滑动。我还使用下面教程中的触摸移动方法绘制用户触摸。
http://www.ifans.com/forums/showthread.php?t=132024
我的问题是手势似乎覆盖了我的绘图。是否可以两者兼而有之,或者有更好的方法吗?
谢谢丹
i have UISwipeGestureRecognizer that detects if the user has swiped. i also draw the users touches using the touches moved method found in the tutorial below.
http://www.ifans.com/forums/showthread.php?t=132024
My issue is the gesture seems to override my drawing. is it possible to do both or is there a better way of doing this?
Thanks
Dan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您调用gestureRecognizer时,所有触摸方法都会被覆盖。您可以在此处查看它的解释。如果您需要所有触摸事件来进行绘图更新,最好只编写自己的代码来识别手势。如果您仍然想使用gestureRecognizer,您可以使用
locationInView:
方法来查找触摸的位置,然后将这些点传递给您的draw方法。我也会考虑使用 OpenglES,因为它更容易一些,而且你可以做更多的事情。 此处有一个很棒的示例项目。希望有帮助!
All of the touches methods get overridden when you invoke a gestureRecognizer. You can view it here in the explanation. It may be best to just write your own code to recognize a gesture if you need all of the touch events for drawing updates. If you still want to use a gestureRecognizer, you can use the
locationInView:
method to find the location of the touch, and then pass those points to your draw method.I would also think about using OpenglES instead, as it isa bit easier, and you can do more things. There's a great sample project about it here. Hope that helps!