in many other posting, they use only reloadRows between beginUpdates and endUpdates.
like this
self.tableView.beginUpdates()
self.tableView.reloadRows(at: [indexPath], with: .fade)
self.tableView.endUpdates()
but when i use this way and use only reloadRows without beginUpdates and endUpdates, i dont know any difference.
why use reloadRows in beginUpdates and endUpdates??
CodePudding user response:
It's just a bad practice which doesn't hurt.
There is no reason at all.
beginUpdates() / endUpdates()
are useful for multiple simultaneous insert/delete/move
operations.
The methods have no effect for a single operation and are completely useless for calling reloadRows