Tommy
Tommy

Reputation: 481

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

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?

Upvotes: 1

Views: 963

Answers (1)

Martin Cote
Martin Cote

Reputation: 29882

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.

Upvotes: 3

Related Questions