Is there a way to increase the speed that you can drag a cell up/down during a table’s movable row mode of a UITableView? For instance, there seems to be a standard speed that the table will allow you to drag the cell when you are moving it around and the scroll speed seems to increase if you hold it near the top/bottom edge of the device screen. For a given cell height and a whole bunch of cells, this might take a while to re-order them all if I have to use their standard slow scrolling.
So basically, I would like to increase the speed that it scrolls up/down when you are dragging the cell so it won’t take as long to get to where you want to drop the cell in place.
I understand that you can speed up the moving process by decreasing cell height to place more cells on the device screen, but I’d rather do this only if I can’t increasing scrolling speed.
Any suggestions or ideas from past experiences with this? Any advice is greatly appreciated!
Here you go. A proof of concept of a speed enhancer of the scroll when you move a cell, SDK 3.1. It may not pass Apple’s requirements since overriding _beginReorderingForCell and _endReorderingForCell looks a little off-spec. There are other ways to determine if a cell starts or ends reordering (e.g. subclassing
UITableViewCelland finding some measure) but this is the easiest I think.The approach is quite simple: for every movement of Y pixels down, we move 2*Y pixels down, only when reordering.
The problem is that the currently dragged cell is a subview of the table view, so it shifts with the table view if we move it. If we are to correct for that within this
setContentOffset, it has no effect since the position of the cell will be set based on values calculated apart from the currentcontentOffset. Therefore we correct an instant later usingperformSelector.I left the debugging lines in there for convenience. All you need to do is to use
FastUITableViewinstead ofUITableView(esp. in you NIB)You may of course want to add some timing things, so that the speed only goes up after 1 second or so. That will be trivial.