You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello Simon!
Nice repo, it's working great and I like it.
I've been using the same approach in one of the projects I've been working on and it turns out that there's one problem I'd like to talk to you about. This solution works very well as the tableView is static. However, if you have to reload the tableView at some point during the scrolling animation, it can lead to unexpected visual bugs. In order to reproduce the issue, the following conditions should be met:
The data in the tableView should change (i.e. set a different number of rows)
reloadData should be called during the scrolling animation
As the result, one of the following can happen:
(rare) tableView stops scrolling and its contentOffset is stuck in between the two snapping points;
(common) tableView abruptly jumps back to its previous position or to zero offset
Here it is visualized:
The obvious solution that comes to mind is to defer the reloading until the moment the scrolling is finished, e.g. call reloadData at scrollViewDidEndDecelerating or scrollViewDidEndScrollingAnimation, but I've tried this and it still won't work.
I would like to know if you have any ideas on this topic.
Cheers!
The text was updated successfully, but these errors were encountered:
Hey, thanks a lot for this well written issue! Sorry for not getting back sooner. I unfortunately don't have any suggestions at this time. In the app where I used this technique, we had no need to reload the data. The only idea I can think of is what you already wrote, to wait for did end decelerating or similar. Weird that it doesn't work.
I hope to get around writing a follow-up blog post at some point and mention problems with this approach, I'll be sure to mention this then.
Hello Simon!
Nice repo, it's working great and I like it.
I've been using the same approach in one of the projects I've been working on and it turns out that there's one problem I'd like to talk to you about. This solution works very well as the
tableView
is static. However, if you have to reload thetableView
at some point during the scrolling animation, it can lead to unexpected visual bugs. In order to reproduce the issue, the following conditions should be met:tableView
should change (i.e. set a different number of rows)reloadData
should be called during the scrolling animationAs the result, one of the following can happen:
tableView
stops scrolling and itscontentOffset
is stuck in between the two snapping points;tableView
abruptly jumps back to its previous position or to zero offsetHere it is visualized:

The obvious solution that comes to mind is to defer the reloading until the moment the scrolling is finished, e.g. call reloadData at
scrollViewDidEndDecelerating
orscrollViewDidEndScrollingAnimation
, but I've tried this and it still won't work.I would like to know if you have any ideas on this topic.
Cheers!
The text was updated successfully, but these errors were encountered: