From f1e6d2bbba91626813b8d94979a4378d41dc0527 Mon Sep 17 00:00:00 2001 From: Rob Amos Date: Wed, 1 Apr 2015 18:18:42 +1100 Subject: [PATCH] Move the cell to be re-ordered instead of the reverse in order to prevent cells being mixed up when dragging too fast. Prevents the placeholder cell being drawn on top of the other cells by lowering its zPosition. --- HPReorderTableView/HPReorderTableView.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/HPReorderTableView/HPReorderTableView.m b/HPReorderTableView/HPReorderTableView.m index b7d3fc7..0b72f2e 100644 --- a/HPReorderTableView/HPReorderTableView.m +++ b/HPReorderTableView/HPReorderTableView.m @@ -123,6 +123,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N { UITableViewCell *cell = [self dequeueReusableCellWithIdentifier:HPReorderTableViewCellReuseIdentifier]; cell.accessoryType = UITableViewCellAccessoryNone; + cell.layer.zPosition = -10; return cell; } else @@ -296,7 +297,7 @@ - (void)removeReorderDragView - (void)reorderCurrentRowToIndexPath:(NSIndexPath*)toIndexPath { [self beginUpdates]; - [self moveRowAtIndexPath:toIndexPath toIndexPath:_reorderCurrentIndexPath]; // Order is important to keep the empty cell behind + [self moveRowAtIndexPath:_reorderCurrentIndexPath toIndexPath:toIndexPath]; if ([self.dataSource respondsToSelector:@selector(tableView:moveRowAtIndexPath:toIndexPath:)]) { [self.dataSource tableView:self moveRowAtIndexPath:_reorderCurrentIndexPath toIndexPath:toIndexPath];