ios - How to delete cell with parse data? -
i want delete cell parse server can tell should write under func commiteditingstyle
?
override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let logcell:uitableviewcell = uitableviewcell(style: uitableviewcellstyle.subtitle, reuseidentifier: "default") let log:pfobject = self.logdata.objectatindex(indexpath.row) as! pfobject logcell.textlabel?.text = log.objectforkey("weight") as? string return logcell } override func tableview(tableview: uitableview, caneditrowatindexpath indexpath: nsindexpath) -> bool { return true } override func tableview(tableview: uitableview, commiteditingstyle editingstyle: uitableviewcelleditingstyle, forrowatindexpath indexpath: nsindexpath) { // delete object parse, remove list } }
when wish delete object parse cloud, method deleteinbackground() should used.
let log:pfobject = self.logdata.objectatindex(indexpath.row) as! pfobject log.deleteinbackground()
you'd want remove cell tableview itself, if isn't done automatically. you'd need delete pfobject logdata first, , reload table. luck.
Comments
Post a Comment