iphone:我如何获得触摸事件的位置? [英] iphone: How do I get the location of a touch down event?
本文介绍了iphone:我如何获得触摸事件的位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个空的基于视图的应用程序。我想在屏幕上每次触摸的x,y坐标做一些事情。
>- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
$ b b函数(来自NSRespondrer类)。你可以从你的视图类中重写它。 'touches'变量保存一组'UITouch'实例,您可以查询视图中的位置。
I have an empty View-Based app. I'd like to do something with the x,y coordinates of every touch down on the screen. How do I do this?
解决方案Override the
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
function (from the NSRespondrer class). You can override it from your view class. The 'touches' variable hold a set of 'UITouch' instances that you can query for the location in the view.
这篇关于iphone:我如何获得触摸事件的位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文