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:
datarepresents 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
editingof table viewtrue. reorder symbol appears.- drag row. code in method
moverowatindexpathreorders entire section.
Comments
Post a Comment