iphone: How do I get the location of a touch down event?

核能气质少年 提交于 2020-01-05 06:14:31

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/542972/iphone-how-do-i-get-the-location-of-a-touch-down-event

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!