美文网首页
swift tableView左滑删除

swift tableView左滑删除

作者: 彼岸花下的暗影 | 来源:发表于2019-06-20 10:08 被阅读0次
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
        return true
    }
    
    func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle {
        return UITableViewCell.EditingStyle.delete
    }
    
    func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCell.EditingStyle, forRowAt indexPath: IndexPath) {
        if editingStyle == UITableViewCell.EditingStyle.delete {
            //删除数据
        }
    }
    
    func tableView(_ tableView: UITableView, titleForDeleteConfirmationButtonForRowAt indexPath: IndexPath) -> String? {
        return "Delete"
    }

相关文章

网友评论

      本文标题:swift tableView左滑删除

      本文链接:https://www.haomeiwen.com/subject/wrxdqctx.html