0
我所拥有的是一个表格视图,其中包含与其他正在与之聊天的人显示不同消息的不同单元格。将单元格向左滑动时,出现Delete
选项。我希望能够删除单元格本身以及与Parse关联的Room
。这是我到目前为止有:在表格视图单元格中单击“删除”时删除关键字
func tableView(tableView: UITableView, commitEditingStyle editingStyle: UITableViewCellEditingStyle, forRowAtIndexPath indexPath: NSIndexPath) {
if editingStyle == UITableViewCellEditingStyle.Delete {
//Delete messages here
let query = PFQuery(className: "Message")
query.whereKey("Room", equalTo: ??????)
tableView.beginUpdates()
tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)
tableView.endUpdates()
}
}
该功能显示Delete
选项,当我点击它,我想将它删除就被点击的有谁知道查询里面所发生的细胞?我有一个Message
类,我想要删除与我删除的单元格关联的Room
键。
在消息中的indexPath唯一一个?如果是这样,你可以通过ObjectId找到ObjectInBackground。现在,您的结果只限于返回与房间名称相同的房间。如果您不想删除整个房间并且它是消息,而您只想删除该房间中的特定消息,则必须按照上面提到的缩小范围 – soulshined