I have implemented a standard UITableViewController
. I have made only some rows in the table to be moveable, ie. canMoveRowAtIndexPath
returns true only for some indexPaths (for rows in the first part of the table). I would like to allow exchange of only those rows that are moveable, ie. for which canMoveRowAtIndexPath
returns true.
Eg. my table looks like this:
Row 1
Row 2
Row 3
Row 4
Row 5
Rows 1, 2, 3 are moveable. So I want to implement the following behavior: row 1 can be exchanged only with rows 2 or 3. Similary, row 2 can be exchanged only with rows 1 and 3. This is one possible layout:
Row 3
Row 1
Row 2
Row 4
Row 5
However, I don't want this to happen:
Row 3
Row 5
Row 2
Row 4
Row 1
How to achieve this?