ios - UITableView Sections via UILocalizedIndexedCollation Delete -
ios - UITableView Sections via UILocalizedIndexedCollation Delete -
i have sections working in tableview this guide
however, method requires maintain 2 arrays.
so when delete object table, have delete source array well.
the simple set same guide linked about,
summary:
data array - simple array of objects sections array - array 2d sections
the tableview utilize sections array populate itself, info array repopulates sections array required.
this delete set up, works.
override func tableview(tableview: uitableview, commiteditingstyle editingstyle: uitableviewcelleditingstyle, forrowatindexpath indexpath: nsindexpath) { if editingstyle == .delete { //println( "\(sections[indexpath.section][indexpath.row].name)" ) var finditeminobjectsarray = sections[indexpath.section][indexpath.row] (index, element) in enumerate(objects) { if finditeminobjectsarray === element { sections[indexpath.section].removeatindex(indexpath.row) objects.removeatindex(index) println("deletes") break } } tableview.deleterowsatindexpaths([indexpath], withrowanimation: .fade) }
my questions are
is bad design ? know of improve solution sectioning out tableview (like contacts list - alphabetically)
is there improve way sorted tableview, ie add together info actual objects ?
thanks
ios uitableview sections uilocalizedcollation
Comments
Post a Comment