Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animation glitch when scrolling during content updates #34

Open
pronebird opened this issue Apr 20, 2016 · 3 comments
Open

Animation glitch when scrolling during content updates #34

pronebird opened this issue Apr 20, 2016 · 3 comments
Labels

Comments

@pronebird
Copy link
Owner

pronebird commented Apr 20, 2016

Cells animate chaotically and content offset gets misplaced If user pans the view during the call of -finishInfiniteScroll. It seems like cells are being reused during beginUpdates and endUpdates animations and due to content offset changes, apply to wrong cells. I can reproduce it with self sizing cells only.

The quick fix is to forcefully cancel pan gesture recognizer before the call to pb_setScrollViewContentInset, however it's not optimal and has side effects.

BOOL shouldCancelPanGestureRecognizer = (self.isTracking || self.isDragging);
if(shouldCancelPanGestureRecognizer) {
    BOOL wasEnabled = self.panGestureRecognizer.enabled;
    self.panGestureRecognizer.enabled = NO;
    self.panGestureRecognizer.enabled = wasEnabled;
}
@pronebird pronebird added the bug label Apr 20, 2016
@pronebird
Copy link
Owner Author

It does not look as bad on iOS 10 beta, so things are getting better!

@KoD4K
Copy link

KoD4K commented Oct 29, 2016

I'm really sorry but may be you found a solution?
I't really important for my users. Thanks a lot!

And your method above has an other glitch effect )=

Sorry again but can I ask?
If table has a method to stop update? I have one table and user can change datasource (with [tableView reloadData]) when table is waiting a new data. In this moment app crash (something like that

Invalid update: invalid number of rows in section 0.

) or insert new (but already wrong) data.

@smalldevcloud
Copy link

I'm really sorry but may be you found a solution?

I had the same error.

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of items in section 0. The number of items contained in an existing section after the update (30) must be equal to the number of items contained in that section before the update (20), plus or minus the number of items inserted or deleted from that section (0 inserted, 0 deleted) and plus or minus the number of items moved into or out of that section (0 moved in, 0 moved out).

For me it turned out better to do infinite scroll without any library, with using UICollectionViewDataSourcePrefetching.s better to do infinite scroll without any library, with using UICollectionViewDataSourcePrefetching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants