我可以删除表格 View 中的行。但我想对 parse.com 上的信息做同样的事情。关于我如何解决这个问题有什么建议吗?
override func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == UITableViewCellEditingStyle.Delete {
// Delete the row from the data source
tableView.beginUpdates()
usernames.removeAtIndex(indexPath.row)
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Fade)
tableView.endUpdates()
} else if editingStyle == .Insert {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
最佳答案
假设 usernames
是 PFObject(可能是 PFUser)的数组,那么您只需在 之后添加
usernames[indexPath.row].deleteInBackground()
tableView.beginUpdates()
关于ios - 如何滑动删除表格单元格以在解析时更新?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34454974/