我的应用程序崩溃了
由于未捕获的异常'NSInternalInconsistencyException'而终止应用程序,原因:'尝试将同一索引路径的多个单元格出列,这是不允许的.如果您确实需要出现比表视图请求更多的单元格,请使用-dequeueReusableCellWithIdentifier:方法(不带索引路径).
当我尝试重新加载我的单个单元格时tableView,这是我按下以重新加载单元格的按钮
@IBAction func reloadCell(_ sender: UIButton) {
let index = IndexPath(row: sender.tag, section: 0)
self.tableView.reloadRows(at: [index], with: .right)
}
Run Code Online (Sandbox Code Playgroud)
这些是我的cellForRow和DidSelectRow
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: resueIdentifier, for: indexPath) as! MyTableViewCell
cell.delegate = self
cell.myCellNumber.text = "\(indexPath.row + 1)"
cell.refButton.tag = indexPath.row
cell.refButton.addTarget(self, action: #selector(CourseClass2.reloadCell(_:)), for: .touchUpInside)
let place = sortedArray[indexPath.row]
cell.update(place: place)
cell.selectionStyle = .none
if indexPath.row == places.count - 1 {
loadPlaces(false) …Run Code Online (Sandbox Code Playgroud)