ios - Re-Order UITableView Sections only -
i have been trying find way re-oder table sections drag , drop re-ordering table rows no success. can guide me go? need re order complete section not rows.
simple way standard delegate methods
implement
tableview:moverowatindexpath:toindexpath:
data
represents data source array containing sections.func tableview(tableview: uitableview, moverowatindexpath sourceindexpath: nsindexpath, toindexpath destinationindexpath: nsindexpath) { let itemtomove = data[sourceindexpath.section] data.removeatindex(sourceindexpath.section) data.insert(itemtomove, atindex: destinationindexpath.section) tableview.reloaddata() }
set
editing
of table viewtrue
. reorder symbol appears.- drag row. code in method
moverowatindexpath
reorders entire section.
Comments
Post a Comment