Is there a high-level gestures library for iPhone development? - iphone

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?

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

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

UIGestureRecognizer. Don’t roll your own.

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.

Related

iphone recognize different shapes with finger movement

I'm developing an application for iPhone, and I want to detect different shapes as my fingers move on iPhone surface. Can anybody help me, how can I detect the different geometric shapes via finger movement or gesture in iPhone sdk.
You can do it, but it's not an easy task. iPhone SDK provides UIGestureRecognizer class, you may create a subclass that UIGestureRecognizer that recognizes a distinctive gesture or character (in your case).
But there is also another approaches. One of them described by Brit Gardner in his blog. Underlying this approach is the N-Dollar Recognizer based on JavaScript. This guy had done a nice job and now you can use MultistrokeGestureRecognizer-iOS library for detecting symbols and shapes. Of course, this library is not perfect and it use specific way (like JSON) to recognize touches, but it's better than nothing.
Thanks, hope this help someone.
There is a sample custom UIGestureRecognizer built inside the iOS SDK documentation which recognizes a checkmark gesture here, specifically in the section entitled "Creating Custom Gesture Recognizers" (couldn't find an easy way to directly link the section). Using this as a template, you should be able write a custom gesture recognizer to correctly recognize your gesture.
The part you will have to provide yourself is the code which defines for your device what exactly it means to make your particular shape of interest.
Incidentally, I'm also in the process of writing my own custom UIGestureRecognizer as an example of recognizing a continuous gesture as opposed to the checkmark's discrete gesture recognition as I would have appreciated an example of this previously.
It is available on Github.
Back in 2009 Daniele Margutti created MCGestureRecognizer project also based upon http://depts.washington.edu/aimgroup/proj/dollar/
If you can find this it will give you a big heads up but will likely need updating to ios5. It used to be available at http://www.malcom-mac.com but that site seems to be down.

Custom gestures on iOS. iPad

I am looking to create my own gestures for my iPad app. I know this can be done but don't know where to start. I read that there is some sample code that can store your custom gestures so you can re use them. Think it was as ajson
I'm looking to draw numbers as custom gestures but any sample code/tutorial where I can get an idea where to start I would be very great full!
Thanks ahead.
The best place to start would be the Event Handling Guide for iOS section on Gesture Recognizers. There's a lot of information there on the different types of gesture recognizers. This should give you enough information on how to create the recognizer(s) that best fits your scenario.

iOS chart framework: TapkuLibrary, Core-Plot or any. Tap of point calls method?

I'm working on an iOS project where tapping on a particular point in a graph should take the user to another scene. Basically, to be able to trigger a method from the user tapping on a point if this makes more sense. Is there any of these frameworks which would make this easy?
Thanks in advance.
I would recommend giving ShinobiControls a try, they have many built-in interactive features.
As a full disclosure, I work for the parent company that owns shinobi controls
Core Plot can certainly do this. It includes several example programs that demonstrate how to set up a delegate to be notified when a point is touched on the plot. How you respond to that notification is up to you.
Yep. TapKu and Core-Plot both have user interaction, if I recall. Core-Plot is definitely powerful, but I'll be damned if it's lightweight or easy to use. TapKu is definitely lightweight and easy to use, but I needed a little more juice for my charts ... like multiple lines, negative numbers, missing data points, not just the single line (with a "goal").
Right now I've got a bit of a hybrid between Josh Buhler's GRChart, Kryali's MultiTouchS7GraphView, BugCloud's Customed-s7graphview and some Frankensteinian menagerie of my own junk to power my chart.
I'm personally pretty fond of Josh's GRChart and recenty Honcheng's iOSPlot for their sheer simplicity (lending well to customization) and frankly, their underdogishness. Neither of those have touch gestures, but it wouldn't take much work at all to reuse the code from BugCloud's xAxisWasTapped: method, or other methods from any of the other touch-enabled charts.

Implementing tracing gestures on iPhone

I'd like to create an iPhone app that supports tracing of arbitrary shapes using your finger (with accuracy detection). I have seen references to an Apple sample app called "GestureMatch" that supposedly implemented exactly that, but it was removed from the SDK at some point and I cannot find the source anywhere via Google. Does anyone know of a current official sample that demonstrates tracing like this? Or any solid suggestions on other resources to look at? I've done some iPhone programming, but not really anything with the graphics API's or custom handling of touch gestures, so I'm not sure where to start.
If you're on 3.1.3 firmware you can use the touchesBegan, touchesChanged, and touchesEnded methods. If you were to do an iPad app on 3.2, you'd have access to gesture recognizers such as UIPanGestureRecognizer - which provides the same basic functionality but also gives you some extra information.
The problem here is that they will not give you a smooth line without some extra work on your part, but these are the basic ways to handle finger tracking.
Unfortunately I don't have any examples to give you, but check out the stuff I mentioned in the developer documentation. You should be able to at least get started from that.
I'm uncertain if gesture recognizers are available in 4.0. Might be worth checking out.

iPhone application : is-it possible to use a "double" slider to select a price range

I'm working on an iphone application (not web app) and I'd like to build a form asking a user to indicate a price range. Instead of using two text fields, I would prefer to use a double slider to set the minimum and the maximum price. I know that it is possible de use a simple slider (sound control for exemple) but i've never seen a double one. Can anyone help ?
This is not possible without creating a custom control. You'll need to inherit from UIControl or UIView and provide a custom drawRect method. You'll also need to respond to touch and drag events to update the state of the control. I have not done this myself, but I would be prepared for a fairly significant amount of work to get everything to respond and display as expected.
I'm curious as to why you need to have both values specified on a single slider? Why not use two sliders either side-by-side or stacked? It would not require any more input steps than a double slider, and would conform more to standard UI guidelines.
I think you can specify multiple thumbs for a single slider if you subclass UISlider, at least I vaguely remember that being possible in MacOSX. But Code Addict is right, you'll probably be better off using the standard controls - a double-thumbed slider seems like it'd be pretty difficult to deal with in the touchscreen environment.
I built such a control and added it to GitHub so feel free to have a look and if you like the control extend it and contribute.
GitHub page: http://github.com/doukasd/DoubleSlider
Blog post (showing a video of how it works): http://dev.doukasd.com/2010/08/double-slider/