views:

23

answers:

1

Hello everyone

I have a UITableView with 2 sections. The UITableCells in the same section can be moved. But I hope to forbid the movement between 2 UITableViewCells in different sections of a same UITableView. Is it possible?

Welcome any commnet

Thanks

interdev

A: 

In the tableView:targetIndexPathForMoveFromRowAtIndexPath:toProposedIndexPath:

if (proposedDestinationIndexPath.section == sourceIndexPath.section)
    return sourceIndexPath;

This will cause the row to go back to it's source indexpath if the section that it's trying to move to, isn't the same section as it's original indexpath

thelaws