iOS - detect when more than one finger is on the screen

sol picture sol · Sep 30, 2010 · Viewed 9.1k times · Source

I'm looking for the best way to detect more than one finger on the screen at time. I'm not detecting taps or pinching, just the fact that more than one touch is happening. There don't seem to be any gesture recognizers for that. What's the best way?

Answer

William Jockusch picture William Jockusch · Sep 30, 2010

In the touchesBegan, touchesMoved, and touchesEnded methods, one parameter is event, which is a UIEvent object. The number of fingers on the screen is [[event allTouches]count].

[EDITED because Josh Hinman pointed out that I had it wrong before -- my previous suggestion of using [touches count] on the touches parameter in those same methods will not work.]