ios - 如何滑动删除表格单元格以在解析时更新?

标签 ios swift parse-platform

我可以删除表格 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/

相关文章:

cross-domain - 用于 Parse 的 RESTful API 如何适用于 HTML 应用程序?

ios - 解析 : send push notification from own server

ios - 通过检测健身器材电缆自动打开应用程序

xcode swift 单元格detailTextLabel.text?。颜色取自日期

iphone - iOS 应用内购买不会对已购买的商品调用 restoreTransaction

swift - Swift 中的元组 "upcasting"

SwiftUI - 为什么 GeometryReader 导致 .frame() 修饰符不起作用?

ios - 如何在Parse上存储iOS录音?

ios - 如何使用静态方法更改属性值?

iphone - Google direction api 请求在 ios5 中无效