Handling multiple fingers swipes on the iPhone
If you are doing development for the iPhone or iPod Touch and your application needs to handle swipe gestures, you may run into an issues when the user uses multiple fingers on the swipe. The iPhone SDK does not give you a way to reliably know which Touch event (UITouch) corresponds to which finger. So when you get a callback that movement has occurred and there are multiple UITouch elements in the event, they get jumbled between calls. So sometimes the first UITouch object is the first finger, sometimes it's the second. If you are trying to have your swipe be relative to the original touch location, this makes it really hard to get an accurate reading of how far they have swiped.
There's an easy way to fix this. But it only works if you application does not need to handle multi-finger gestures, like pinches. And that is to just turn off handling of multiple touches in the view. If you do this, you'll always just have one UITouch event and it will always correspond to the same finger.
To do this open the Interface Builder and select the View in which the touches are happening. Then just uncheck the box next to "Multiple Touch" (as seen here):
Turning off multiple touch support on the iPhone
Once you uncheck this box (which is checked by default), handling swipes will be a lot easier in your code.
There's an easy way to fix this. But it only works if you application does not need to handle multi-finger gestures, like pinches. And that is to just turn off handling of multiple touches in the view. If you do this, you'll always just have one UITouch event and it will always correspond to the same finger.
To do this open the Interface Builder and select the View in which the touches are happening. Then just uncheck the box next to "Multiple Touch" (as seen here):
Turning off multiple touch support on the iPhone
Once you uncheck this box (which is checked by default), handling swipes will be a lot easier in your code.
| Rating: | 100% positive, 1 Vote |
| Categories: | iPhone iPod Touch development apple Xcode |
| Added: | on May 14, 2009 at 2:05 pm |
| Added By: | an anonymous user |
| Searches: | touch iphone multiple swipe finger |

