What you need to do is this:
When a user moves the cell you place that cell into the new index path (if the one the are replacing isn't locked).
Then with the one that has been replaced you need to move its index row by +1. This will likely need to be done in a loop and you need to check that the next cell isn't locked. if it is locked then you just increment the row by another 1. For example:
CELL 1
CELL 2 - locked
CELL 3
I move CELL 3
to CELL 1
. You then need to check if CELL 2
is locked. If it is (as it is in this example) you move CELL 1
to CELL 3
instead.
//This is the card that is moving
PlayingCard *cardToMove = [self.deck objectAtIndex:fromIndexPath.row];
//This is the card that is being replaced and also needs to move.
PlayingCard *cardToReplace = [self.deck objectAtIndex:toIndexPath.row];
//We need to check if the next cell is a position which we can occupy with the cardToMove. This is where the loop will go.
NSInteger increment = 1;
PlayingCard *cardNextToReplaced = [self.deck objectAtIndex:toIndexPath.row + increment];
while (cardNextToReplaced.isLocked) {
increment ++;
cardNextToReplaced == [self.deck objectAtIndex:toIndexPath.row + increment];
}
//This should now be a 'free space'
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:toIndexPath.row + increment inSection:toIndexPath.section];
//So now you just move the cardToMove to it's new index path. The cardToReplace should be moved the newly created `indexPath` above this. That should be a 'free space'.