ios - Move UITableViewCell index in TableView [SWIFT] -
i move uitableviewcell end of array once selected. how change index of uitableviewcell?
var tableviewdata = ["1", "2","3","4"] ...  func tableview(tableview: uitableview!, didselectrowatindexpath indexpath: nsindexpath!){     let myselectedcell:uitableviewcell = tableview.cellforrowatindexpath(indexpath)      // move cell     ... } thanks
this should work specific example (note assumes table view has 1 section):
// remove item data array let item = data.removeatindex(indexpath.row) // add item again, @ end of array data.append(item)  // move corresponding row in table view reflect change tableview.moverowatindexpath(indexpath, toindexpath: nsindexpath(forrow: data.count - 1, insection: 0)) 
Comments
Post a Comment