Are there one or two idiomatic ways to handle the kind of UI interaction described below? Perhaps a custom class is unnecessary?
I am implementing drag and drop in an iPadd app and would like to handle the case where the draggable is not released upon the droppable and the pan gesture leaves the UIView
.
- The view expands and gets a border when the draggable is over it, and it will return to its previous size and lose the border when the draggable leaves the area. There will be a noticeable delay before the down-scale animation begins.
- It is possible the draggable will be brought back over the zone before the scale-down animation begins, suggesting the need for some kind of debouncing, i.e., something to collect the events that occur within a period of time and treat them as one event.
- I know a large number of events are fired off during a pan gesture, and I don't want to allocate unnecessary resources (e.g., timers).
I was thinking of using a single custom timer, perhaps along these lines, but perhaps there's something much simpler for this?