In Apple\'s Messages app, when you click a correspondent\'s name and switch to the table view of the conversation (with balloons for each message), the table appears scrolle
The issue with scrollToRowAtIndexPath method is its slow and the tableView takes time to scroll to the bottom.
i had the exact same problem, after trying everything(same as you), this worked, the key is if you're using autolayout initialize scrollToBottom to true and then do this
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
// Scroll table view to the last row
[self scrollToBottom];
}
-(void)scrollToBottom {
if (shouldScrollToLastRow)
{
CGPoint bottomOffset = CGPointMake(0, self.tableView.contentSize.height - self.tableView.bounds.size.height);
[self.tableView setContentOffset:bottomOffset animated:NO];
} }
doing this will ensure you're almost at the bottom of you're tableView but might not be at the very bottom as its impossible to know the exact bottom offset when you're at the top of the tableView, so after that we can implement scrollViewDidScroll
-(void)scrollViewDidScroll: (UIScrollView*)scrollView
{
float scrollViewHeight = scrollView.frame.size.height;
float scrollContentSizeHeight = scrollView.contentSize.height;
float scrollOffset = scrollView.contentOffset.y;
// if you're not at bottom then scroll to bottom
if (!(scrollOffset + scrollViewHeight == scrollContentSizeHeight))
{
[self scrollToBottom];
} else {
// bottom reached now stop scrolling
shouldScrollToLastRow = false;
}
}