0

I have a UITableView with multiple sections that looks more or less like this.

I'm "faking" section headers with rows because I'd like the users to be able to re-order the sections. There seems to be no facility to do so through proper section headers and drag-and-drop.

The way I picture this going is: the user would start dragging the section header using the re-order mark on the right (the three lines), the sub-cat rows would momentarily disappear, only the "headers" remain. The user picks the final position and drops the "header". Business magic is executed to sort the underlying data structure, and the sub-cat rows reappear in the correct position.

I can't find in the docs anything like a willStartDraggingRowAtIndex or similar. Is this not doable? Should I revert to using proper section header custom views showing dumb up and down buttons, or some other trickery like a separate screen to re-order categories only?

Morpheu5
  • 2,610
  • 6
  • 39
  • 72
  • The easiest way I can think of is to make the cell has a `UITableView` in it. The limitation will be that you can't move sub cats beyond Categories. If you want to implement what you want as it is, you need to implement the reordering all by yourself. – Ryan Apr 24 '18 at 19:52
  • Table in cell sounds a lot of work, but it may work. The only problem I can foresee is that it would be hard to reposition the reorder control of the "section" cells to make it look flush with the inner table's cells. I might try to fake with a long tap gesture recogniser instead, that way I can plug my callbacks where I want. – Morpheu5 Apr 24 '18 at 20:46

0 Answers0