Skip to content

Instantly share code, notes, and snippets.

@simonnickel
Last active August 29, 2015 13:56
Show Gist options
  • Save simonnickel/9048440 to your computer and use it in GitHub Desktop.
Save simonnickel/9048440 to your computer and use it in GitHub Desktop.
#pragma mark - SNLInteractionTableView delegate - Reorder
- (void)startedReorderAtIndexPath:(NSIndexPath *)indexPath {
// additional setup when reordering starts
NSLog(@"Reordering started");
}
// Update your data source when a cell is draged to a new position. This method is called every time 2 cells switch positions.
- (void)moveRowFromIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
// update DataSource when cells are switched
NSLog(@"Switched Cells");
// Reorder example:
id object = [self.itemList objectAtIndex:fromIndexPath.row];
[self.itemList removeObjectAtIndex:fromIndexPath.row];
[self.itemList insertObject:object atIndex:toIndexPath.row];
}
- (void)finishedReorderAtIndexPath:(NSIndexPath *)indexPath; {
// additional cleanup when reordering ended
NSLog(@"Reordering ended");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment