This question from 2009 wasn’t answered, and it is one of the very few mentions of this problem on the .

The problem: I want to re-order the of a in the same way I can do with the rows (i.e., by dragging).

The way I see this working like is: you turn on editing on the table, re-order indicators appear. When you start dragging a section header (or a cell acting as a fake section header, which is sub-optimal [1]), all the regular cells “disappear”, so you can only move sections around (and it is easier if you have more than a handful of sections).

LPRTableView appears to address the problem, but it is quite tricky to set up correctly when re-ordering sections. I tried for a full day with not very much success. Plus, [1].

A not-so-great-but-acceptable solution is to have buttons like ⬆️⬇️ in the headers (proper headers can be used here) but it is a little awkward.

Another not-so-great-but-acceptable solution is to have an extra step (like, a button) that brings up a new UITableView showing only the sections as cells, and allow re-ordering there. fine, but creates more issues than it solves [2].

I can’t see anything in the docs by way of, for example, a hook called when re-ordering starts/ends. Or rather, there is the ending bit but I can’t see the beginning one.


[1] This allows rows to be placed before the section header, in principle, and you have to manually catch that, with a bad-looking visual effect.

[2] Where would I even place such a control, especially if I have a crowded UI already, or I want to keep my UI minimal?

Source link


Please enter your comment!
Please enter your name here