given that none of the answers here iOS UITableView Scroll to bottom of section work correctly when height of tableview rows varies I've got to ask again: how to I scroll reliably to the bottom of the table? Meaning: the bottom of the table content is lined up with the bottom of the table view
this
extension UITableView
{
func scrollToBottom(animated: Bool = true)
{
layoutSubviews() // if rowHeight UITableViewAutomaticDimension you have to force layout to get semi-correct content size height
let csh = contentSize.height
let fsh = bounds.size.height
if csh > fsh {
let offset = csh - fsh
setContentOffset(CGPointMake(0, offset), animated: animated)
}
}
}
almost works but still underscrolls by about 150-200 px on both 9.3.1 and 8.4.1
let offset = csh
and it happily overscrolls showing on top the content it underscrolled by in case let offset = csh - fsh followed by the wast whitespace filled with void
given that "bounces vertically" is checked for the tableview in the storyboard it properly bounces in the latter case given a slightest provocation of a user touch ;-)
this is unioslike complex and very much androidlike
this should've been simple, right? right?