EstimatedRowHeight is used by UIKit to evaluate the whole contentSize (and scrollIndicatorInset), so if you add a new row at the end with automatic row measurement, you must reset the ratedRowHeight to the actual average of the entire tableView before the scroll animation.
This is not a good solution, because its tasks are easier to calculate the line height in the old style - manually. Or add a new cell height value to the height of the contents of the old table.
But since you are adding a new row to the end column, you can scroll the middle or top position that ends with the bottom position, because there is contentInset.bottom = 0. And also the animation will look better.
So:
commentsFeed.scrollToRowAtIndexPath(indexPath, atScrollPosition: .**Middle**, animated: true)
It seems that in the .Middle and .Top positions there is some condition under the hood in the animation, which interferes with making a gap between the bottom edge and the contents of the table (+ contentInset.bottom)
PS Why not use manuall line height calculation?
Because there is autorun, and I believe that “auto” is a shortcut to automatic. It will also save your time and problems with custom fonts, assign a row, a combo box with a lot of tags and other subheadings, etc.
source share