Differentiating Between UITouch Objects On The iPhone

Posted by Jasarien on Stack Overflow See other posts from Stack Overflow or by Jasarien
Published on 2009-06-13T01:19:21Z Indexed on 2010/03/28 7:23 UTC
Read the original article Hit count: 481

Hey guys,

I'm trying to differentiate between two (or more) UITouch objects on the iPhone. Specifically, I'd like to know the order in which the touches occurred.

For instance, in my -touchesBegan:withEvent: method I get an NSSet of UITouch objects. Now I can find out how many touches there are, but, which object represents which finger?

I notice the timestamp property on UITouch - is this what I'm looking for? I see how that would be useful to obtaining the last or first touch - providing the touches don't mutate...

Therein lies my problem. I can use the timestamp to single out the latest touch, but then the touch that occurred first moves, and IT becomes the latest touch...

At the end of this exercise, I'd like to be able to implement the "pinch" gesture to zoom in or out, etc.

Any help would be greatly appreciated, thanks.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c