InsertRows to UITableView swift 4 has Error: My last row has scroll from top to bottom

94 Views Asked by At

Here is my codes when expand section:

let lastScrollOffset = self.tableView.contentOffset
self.tableView.beginUpdates()
self.tableView.insertRows(at: indexPathsForSection(section: section), with: .none)//reloadSections([section], with: .fade)
self.tableView.endUpdates()
self.tableView.layer.removeAllAnimations()
self.tableView.setContentOffset(lastScrollOffset, animated: false)
let indexPath = IndexPath(row: NSNotFound, section: section)
self.tableView.scrollToRow(at: indexPath, at: .none, animated: true)
0

There are 0 best solutions below