I have a table view. And I have multiple rows. While doing the reorder in editing mode, I want one row to stay in the first index all the time. So, if a user wants to swap a row with the first row, it shouldnt allow it. But it should be possible between the second and the third row.
How can I do this? Thank you very much in advance
Set the first table view cell's showsReorderControl
to NO
and return NO
in tableView:canMoveRowAtIndexPath:
for the first row.
You can also implement the UITableViewDelegate method tableView:targetIndexPathForMoveFromRowAtIndexPath:toProposedIndexPath:
Here you can return an alternate index path if the proposed one is (0, 0).
Return Value
An index-path object locating the desired row destination for the move operation. Return proposedDestinationIndexPath if that location is suitable.
Discussion
This method allows customization of the target row for a particular row as it is being moved up and down a table view. As the dragged row hovers over a another row, the destination row slides downward to visually make room for the relocation; this is the location identified by proposedDestinationIndexPath.