Ios swift无法删除行
我正试图删除uiIos swift无法删除行,ios,swift,uitableview,Ios,Swift,Uitableview,我正试图删除uitableview中的一行,因此我创建了以下方法: func showActionSheet(index: IndexPath) { let actionSheet = UIAlertController(title: "Chat löschen oder melden?", message: "", preferredStyle: .actionSheet) actionSheet.addAction(UIAlertAction(title: "Löschen
tableview
中的一行,因此我创建了以下方法:
func showActionSheet(index: IndexPath) {
let actionSheet = UIAlertController(title: "Chat löschen oder melden?", message: "", preferredStyle: .actionSheet)
actionSheet.addAction(UIAlertAction(title: "Löschen", style: .default, handler: { (alert: UIAlertAction!) -> Void in
if self.isFilter() {
let object = self.filteredData[index.row]
self.removeFromUser(openChatsId: object.openChatsId!)
self.filteredData.remove(at: index.row)
} else {
let object = self.mDataset[index.row]
self.removeFromUser(openChatsId: object.openChatsId!)
self.mDataset.remove(at: index.row)
}
self.tableView.deleteRows(at: [index], with: .bottom)
}))
actionSheet.addAction(UIAlertAction(title: "Melden", style: .default, handler: { (alert: UIAlertAction!) -> Void in
self.reportUser(index: index)
}))
actionSheet.addAction(UIAlertAction(title: "Abbruch", style: .cancel, handler: nil))
self.present(actionSheet, animated: true)
}
但它引发了这样一个错误:
无效更新:节0中的行数无效。更新(11)后现有节中包含的行数必须等于更新(11)前该节中包含的行数
你能显示你的
numberOfRows(部分:)
方法吗?你能显示你的numberOfRows(部分:)
方法吗?