Suppose I have two fingers touching iPhone's screen but just one is moving.
TouchesMoved will just show one finger (event).
How do I know which of the two fingers TouchesMoved is referring too?
Suppose I have two fingers touching iPhone's screen but just one is moving.
TouchesMoved will just show one finger (event).
How do I know which of the two fingers TouchesMoved is referring too?
Unfortunately if you think about it there's no "definitive" way to associate one finger with one touch point. It isn't, after all, that your fingers have globally unique id's that the iPhone has the ability to sample.
What you need to do is keep a record of the "prior" locations, which is useful for managing pinches and other things anyway - and tag each finger based on the proximity to the prior touches set.
You get the touches as a NSSet *
from the TouchesBegan
method, you'll need to loop through all the touches and put them into context of your app so that you can identify them later.
It would've been much easier to help you if you described your intent ...
You wrote
TouchesMoved will just show one finger (event).
but this isn't actually true: as long as two fingers are touching the screen, and at least one of them moves, you'll get a touchesMoved
with both fingers.
if one finger is picked up temporarily, you may get some touchesMoved
calls with just one finger, so you have to decide what to do about that.
I discovered that it is possible to do what I want. Just check Stanford's CS193P course on iTunesU.