tags:

views:

312

answers:

1

I have an "add" button that's represented by a UIBarButtonItem. Hitting the "add" button adds an object into a list that represents a moment in time. By default, that time is "now"...but I'd like to be able to use dragging behavior to let the user specify earlier times for the object. Here's the behavior I want to implement:

  • If the user touches on the UIBarButtonItem and lets go quickly, an object is added to the list that represents "now."

  • If the user touches on the UIBarButtonItem and drags, a little UI pops up that shows the time that the distance of their drag represents. (The further they drag, the further back in time.) When they let go, the object representing an earlier time will get added to the list.

(Though the description of the behavior is complicated, I'm convinced this will be pretty intuitive for users of the app.)

I haven't implemented code for anything but the most simple touches in the past, and I'm at a loss as to the best way to try this. Does anyone have any suggestions, or could point me towards some sample code that implements something like this?

Thanks very much.

A: 

You probably should consider UISwipeGestureRecognizer. If that's not sufficient, then you'll have to start looking at touchesBegan: and UIEvent and the Event Handling section of the iPhone Application Programming Guide.

Paul Lynch
UISwipeGestureRecognizer is only in OS 3.2, so that won't be of benefit to me. I'll start reading some more in the Programming Guide.
Greg Maletic