How to get notified of UITableViewCell move start and end?

Cornelius picture Cornelius · Mar 28, 2012 · Viewed 8.9k times · Source

I have a UITableView in my iOS app that gets refreshed periodically. The user is also able to move the tableview rows at all times (the tableview is always in editing mode).

I want to stop the refresh timer when the user starts dragging a row and start it again when the row is dropped.

The last part should be easy with moveRowAtIndexPath, but how to get notified about drag start?

Answer

marcprux picture marcprux · Jun 1, 2012

Your UITableViewDelegate will receive the following notifications in response to reordering actions:

- (void)tableView:(UITableView *)tableView willBeginReorderingRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)tableView:(UITableView *)tableView didEndReorderingRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)tableView:(UITableView *)tableView didCancelReorderingRowAtIndexPath:(NSIndexPath *)indexPath;