override func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {
//判断是否是删除按钮
if editingStyle == UITableViewCellEditingStyle.delete{
//删除选中度假区所在行
vacationList.remove(at: indexPath.row)
//删除所在单元格
tableView.deleteRows(at: [IndexPath], with: UITableViewRowAnimation.top)
}
}
你的tableView.deleteRows(at: [IndexPath], with: UITableViewRowAnimation.top)这里 的IndexPath是类型 应该用indexPath。
我自己写cell的删除比较习惯截图的写法