How can I get the touch event?

I want to receive a touch event. Also I need some coordinates to indicate where the user touched the screen.

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

0


source to share


1 answer


Take a look at the -touchesBegan, -touchesMoved and -touchesEnded methods of the UIView class - you'll want to subclass this and override these methods. Each of these provides you with an NSSet of UITouch objects; if you are not dealing with multitouch, you can get touch object by calling -anyObject on set. Then call -locationInView: with the view itself (or another view where you want the coordinates to be relative).



+1


source







All Articles