Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rearrange UITableView sections, rows, and rows between sections

I am trying to accomplish the following 3 requirements:

  1. Display a UITableView that has sections of content.
  2. Be able to rearrange the rows of the table between sections.
  3. Be able to rearrange the sections, similar to how rearranging rows works.

(Also, I cannot use a UICollectionView)

I can currently do the first two without any problem. I've done iOS development for a while now, but I'm stumped on how to actually rearrange the sections, and make it appear as it would be if you were moving a row.

I've tried to make a nested table in a UITableViewCell, and pretend the first cell is a "header," but this only works for moving sections and breaks the ability to rearrange rows between sections (admittedly, I could be going about this wrong).

I realize this is a complex question, but any help would be appreciated - even if the answer is "can't be done."

like image 689
macandyp Avatar asked Feb 01 '13 20:02

macandyp


1 Answers

I think you'll have to create something custom here, you won't be able to find some readymade section reordering functions. I dont know if this would help but here's a link to github project (https://github.com/shusta/ReorderingTableViewController) which tries to mimic the "rows reordering" feature provided by iOS in edit mode using gestures and custom animations and views. Maybe you can go through it and try to create something similar for sections. Hope this helps

like image 92
Dhruv Goel Avatar answered Sep 19 '22 16:09

Dhruv Goel