views:

25

answers:

1

I'm wondering if anyone has a link to a good tutorial or can point me in the right direction to recreate the 'drag to reorder' cells in a UITableView like Epic Win App. The basic idea is you tap and hold on a list item and then you drag to where you want the item to be. Any help would be greatly appreciated.

+2  A: 

It is pretty straight forward - which is probibly why there is no explicit tutorial on the matter.

Just create the UITableView normally, but set the showsReorderControl of each cell to TRUE. When you go into editing mode (normally by pressing the "edit" button and setting the "Editing" value of the UITableView to TRUE) - the reorder bars will appear in the cells.

Note:

If your data source implements tableView:canMoveRowAtIndexPath: - and it returns "NO" - the reorder bars will not appear.

You will also need to implement – tableView:moveRowAtIndexPath:toIndexPath: in the Data source delegate.

Brad
The one thing I would like to be able to do is supersede the button and make the whole cell the button. So you can just drag the cell around. Do you know any way of how to do that? Or a stepping stone of how to do that?
Pudgeball
It is very easy to subclass UITableCellView into anything you want - so it would just be a matter of making yours with your own reorder bar button/area.
Brad
Okay, thanks for the help :)
Pudgeball