I'm looking for a way to get all the current touches even if no event has occurred. I know about [UIEvent allTouches]
but I need to be able to see "these are all the touches on the screen" even if none of them has changed. It seems like it should be possible because allTouches
can access touches which haven't been updated, so the phone is tracking them.
views:
316answers:
2hitTest will tell me which view a point is in. I want a set of all the touches on the screen. Unless I've misunderstood something.
David Kanarek
2010-01-21 05:24:09
I generally hitTest with pointInside to determine the coordinates the user touches on the top most view when a component is being finicky in the responder chain (like with nested scrollviews, custom GUI widgets, etc) The [UIEvent allTouches] returns an array of all the touches (UITouch) the API wants available to you. What you want is access to the internal state of the last system UITouch? I think the best you will be able to do is access touchesBegan and touchesEnded, and cache a UITouch compare them yourself.
David Sowsy
2010-01-21 14:01:12
Yeah, I was afraid I'd have to do it myself, just seems silly they don't open it up to you.
David Kanarek
2010-01-21 21:20:49
Seems the best thing to do is cache the points as you said. If you want to add that as an answer, I'll accept it.
David Kanarek
2010-01-24 06:42:15
A:
Override touchesBegan and touchesEnded, and compare the current point against the cached point from the event.
David Sowsy
2010-01-24 16:41:55
Note that I had no current point to compare with. I simply used `touchesBegan/Moved/Ended` to maintain a cache of touch locations and referred to that when necessary.
David Kanarek
2010-01-24 17:42:32