(Happy to accept an answer in Swift or Objective-C)
My table view has a few sections, and when a button is pressed, I want to insert a row at the end of section 0.
I don't know how to fix it correctly, but my solution works for me
// hack: for fix jumping of tableView as for tableView difficult to calculate height of cells
tableView.hackAgainstJumping {
if oldIsFolded {
tableView.insertRows(at: indexPaths, with: .fade)
} else {
tableView.deleteRows(at: indexPaths, with: .fade)
}
}
extension UITableView {
func hackAgainstJumping(_ block: () -> Void) {
self.contentInset.bottom = 300
block()
self.contentInset.bottom = 0
}
}