Я пытаюсь позвонить ( cellForRowAt indexPath: IndexPath )
метод вручную с кнопки, как я могу сделать, чтобы для записи я уже пытался перезагрузить метод данных на UITableView
.
Это не сработало.
self.myTableView.reloadData()
Почему мне нужно это сделать, потому что я пытаюсь реализовать решение из stackoverflow, решение выглядит так:
func configureVisibleCells(for tableView: UITableView?, animated: Bool) {
self.tableView(tableView, configureRowsAtIndexPaths: tableView?.indexPathsForVisibleRows, animated: animated)
}
func tableView(_ tableView: UITableView?, configureRowsAtIndexPaths indexPaths: [Any]?, animated: Bool) {
for indexPath in indexPaths as? [IndexPath] ?? [] {
let cell: UITableViewCell? = tableView?.cellForRow(at: indexPath)
if cell != nil {
self.tableView(tableView, configureCell: cell, forRowAt: indexPath, animated: animated)
}
}
}
func tableView(_ tableView: UITableView?, configureCell cell: UITableViewCell?, forRowAt indexPath: IndexPath?, animated: Bool) {
// Cell configuration
}
"Настройка ячейки в
tableView(_ tableView: UITableView?, configureCell cell: UITableViewCell?, forRowAt indexPath: IndexPath?, animated: Bool) method and call this method in your tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell .
и когда вам нужно перезагрузить видимые ячейки, вызовите метод
tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell"
Теперь мне нужно назвать это, как сказал парень, который опубликовал решение.