bvogelzang / BVReorderTableView

Easy Long Press Reordering for UITableView
MIT License
234 stars 59 forks source link

Added ReorderTableViewDataSource and canMoveRowFromIndexPath:toIndexPath... #19

Closed stoprocent closed 10 years ago

stoprocent commented 10 years ago

It's just a dataSource and dataSource method which can prevent from dragging rows between sections etc. For example if I want to allow moving rows in same section:

- (BOOL)canMoveRowFromIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
    if (fromIndexPath.section == toIndexPath.section) {
        return YES;
    }
    return NO;
}
bvogelzang commented 10 years ago

You can already use the built in table view delegate method tableView:targetIndexPathForMoveFromRowAtIndexPath:toProposedIndexPath: for this.

Apple Docs

stoprocent commented 10 years ago

Oh nice ... skipped that :)