From e5096bd2f0cdd18f4facdb68fad64a0ca2c3d81e Mon Sep 17 00:00:00 2001 From: Neeraj Baid Date: Mon, 30 Jun 2014 21:10:40 -0700 Subject: [PATCH] Disallow reordering of cells that are specifically blacklisted by datasource. --- BVReorderTableView.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/BVReorderTableView.m b/BVReorderTableView.m index 1c0ade1..2f5bf39 100644 --- a/BVReorderTableView.m +++ b/BVReorderTableView.m @@ -267,6 +267,11 @@ - (void)updateCurrentLocation:(UILongPressGestureRecognizer *)gesture { NSInteger newHeight = [self rectForRowAtIndexPath:indexPath].size.height; if (indexPath && ![indexPath isEqual:self.currentLocationIndexPath] && [gesture locationInView:[self cellForRowAtIndexPath:indexPath]].y > newHeight - oldHeight) { + if ([self.dataSource respondsToSelector:@selector(tableView:canMoveRowAtIndexPath:)]) { + if (![self.dataSource tableView:self canMoveRowAtIndexPath:indexPath]) { + return; + } + } [self beginUpdates]; [self deleteRowsAtIndexPaths:[NSArray arrayWithObject:self.currentLocationIndexPath] withRowAnimation:UITableViewRowAnimationAutomatic]; [self insertRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationAutomatic];