tags:

views:

187

answers:

1

I'd like to receive a touch event. Also I'd like some kind of coordinates indicating where the user touched the screen.

How can I receive a touch event in an iPhone app?

+1  A: 

Look up the -touchesBegan, -touchesMoved, and -touchesEnded methods of the UIView class - you'll want to subclass that and override those methods. Each one gives you an NSSet of UITouch objects; unless you're dealing with multitouch, you can get the touch object by calling -anyObject on the set. Then, call -locationInView: with the view itself (or another view that you want the coordinates relative to).

Noah Witherspoon