5

When I try to scroll all the way to the bottom of a table view when my view first appears, it doesn't scroll to the correct bottom cell. It's somewhere close to the end but not quite.

If the method is called again later, it then scrolls to the bottom. For now my solution was to scroll twice, and it only works if there's a delay on the second one.

I'm wondering if this is a bug in iOS 8 or if there's anything I can actually do the proper way.

NSIndexPath* path = [NSIndexPath indexPathForRow:[self.someArray count] - 1 inSection:0];

[self.someList scrollToRowAtIndexPath:path
                     atScrollPosition:UITableViewScrollPositionBottom
                             animated:NO];

//TODO: this is kindof a dirty hack for now, there seems to be a bug in ios8 auto sizing cells and figuring out the proper scroll location

dispatch_after(0, dispatch_get_main_queue(), ^{
    [self.someList scrollToRowAtIndexPath:path
                     atScrollPosition:UITableViewScrollPositionBottom
                             animated:NO];
});
6
  • You need to implement heightForRowAtIndexPath or estimatedHeightForRowAtIndexPath.
    – Hot Licks
    Feb 19, 2015 at 18:45
  • but you're supposed to not implement height for row at index path in order for auto sizing to work on iOS 8. captechconsulting.com/blog/tyler-tillage/… And estimatedHeight is a property.
    – iseletsky
    Feb 20, 2015 at 0:24
  • Ah yes, that method is there. So is it recommended to implement estimatedHeightForRowAtIndexPath? Seems like I might just end up doing the same work though. We've had other parts of our app show this same jerky movement.
    – iseletsky
    Mar 5, 2015 at 0:42
  • This still isn't working right in iOS 10 :/
    – trapper
    Nov 11, 2016 at 7:38

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.