views:

1575

answers:

5

The iPhone platform has a number of common gesture idioms. For example, there are taps, pinches, and swipes, each with varying number of fingers. But when you're developing an app, it's up to you to implement these things based on low-level information about the number and locations of touches. It seems like this is a prime candidate for a library. You would register a delegate, set some parameters like multi-tap interval and swipe threshold, and get calls like swipeStarted/Ended, pinchStarted/Ended, multiTap, etc. Does such a library exist?

+2  A: 

Here is one for detecting the circle gesture, with the source code provided. Might be useful for adapting it to detect other geatures.

http://iphonedevelopment.blogspot.com/2009/04/detecting-circle-gesture.html

erotsppa
+5  A: 

I've set up just such a project. It's not a library, but it is full of sample code for pinch/stretch, tap and hold, etc.

Blog:

http://6tringle.com/blog/2009/TouchSampleCode.html

Github:

http://github.com/kailoa/6tringle-touchsamplecode/tree/master

Kailoa Kadano
Not exactly what I had in mind, but perhaps just as good. Thanks!
n8gray
Good example, but not a library. I forked the project and attempted to create a library. http://github.com/bentford/GestureDetect
bentford
A: 

I forked Kailoa's very nice example and attempted to create a library.

http://github.com/bentford/GestureDetect

I intend to add a combination "pinch-zoom and drag" gesture like the one in the maps app. Once I get it working, I'll post on github.

bentford
A: 

I have enough to do without having to learn yet another stupid code repository. Github is crap.

Rick
Should be a comment if not left entirely unsaid.
Lawrence Johnston
+1  A: 

UIGestureRecognizer. Don’t roll your own.

Evadne Wu
I'd say this is the correct answer if you don't have to support iOS 3.1.x, but for now quite a few of us do.
n8gray