views:

30

answers:

1

I have a UITableView with 2 sections in it. I have enabled rearranging in my table view, but I have a strange problem.

I do not want the user to be able to rearrange rows between sections (I only want users to be able to rearrange rows within their section). If I try to drag a row from the first section to the second section, it will not allow me, which is what I want. If I drag a row from the second section to the first section, it WILL let me, which I do not want.

Is this a bug in Apple's frameworks or is this actually how it is supposed to behave, and how can I get the behaviour I want?

EDIT: I'm experiencing some inconsistencies here. Earlier I was unable to drag a row from the first to the second section but now I can. How do I disable rearranging between sections?

+2  A: 

I'm not aware of a specific bug, but have you been overriding tableView:targetIndexPathForMoveFromRowAtIndexPath:toProposedIndexPath: explicitly to check the section the row is being attempted to move into? Maybe you're not and the default behavior just happens to work one way and not the other?

Joost Schuur
This should method should work. Just check if proposedDestinationIndexPath.section is the same as sourceIndexPath.section and return either the old or new index path depending on that.
paxswill