views:

119

answers:

1

This is similar to a prior question, but it was not properly answered.

On the iPhone, if you touch and hold your finger on an icon, it starts vibrating, then you can drag the icon around while the other icons move aside and rearrange dynamically. Ignoring the vibration effect, how can I implement the dragging and the real-time dynamic reordering?

A: 

You must create you own view controller and manage these events:

- touchesBegan:withEvent:  
– touchesMoved:withEvent:  
– touchesEnded:withEvent:  
– touchesCancelled:withEvent:  

You must also set the property multipleTouchEnabled of the corresponding view to YES.

Basically, the action begins with touchesBegan. Then the event touchesMoved is used to move the icon along the finger trajectory and reorder others icon. Collision detection is really easy: the dragged icon only bumps one other icon at a time. Determine for the touch position which icon is being bumped and reflow this icon, and the following ones, from one cell.

Good luck!

rjobidon