0
let indexPaths = (0..<array.count - 1).map { i in
return IndexPath(item: i, section: section)
}
tableView.beginUpdates()
if hidden[section] {
array.remove(at: IndexPath(item: item, section: section).row)
tableView.deleteRows(at: indexPaths, with: .fade)
} else {
tableView.insertRows(at: indexPaths, with: .fade)
}
tableView.endUpdates()
そのセクションのヘッダーがタップされている場合、UITableViewのセクションのすべてのセルを削除します。しかし、正しく動作していないようです。SwiftのUITableViewで行を削除する方法
エラーが"Cannot convert value of type CountableRange<Int> to expected argument Int".
すべてのセルを削除する正しい方法は何と言いますか?
データソース配列内のすべてのアイテム( 'removeAll()')を削除し、適切なセクションを渡してtableView上で 'deleteSections()'を呼び出します。 – vadian