I have the same problem with the one below.
https://stackoverflow.com/questions/26327764/strange-behavior-on-scroll-uitableview#=
A chat application needs UITableView to scroll to the bottom.
But the table is not scrolled to the last row but 5-6 rows above.
I have already tried using contentOffset and scrollToRowAtIndexPath but both cannot resolve this problem.
I guess that some code should be added to viewDidLayoutSubviews() because I am using auto layout, but I have no idea.
Do you know how to correct this issue?
scrollToRowAtIndexPath
let indexPath = NSIndexPath(forRow:(self.tableView.numberOfRowsInSection(0)-1),
inSection: self.tableView.numberOfSections()-1 as Int)
self.tableView.scrollToRowAtIndexPath(indexPath,
atScrollPosition: UITableViewScrollPosition.Bottom,
animated: true)
contentOffset
let offset = CGPoint(x: 0, y: self.tableView.contentSize.height
- self.tableView.frame.size.height
+ self.tableView.contentInset.bottom)
self.tableView.contentOffset = offset