-
Notifications
You must be signed in to change notification settings - Fork 148
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
setContentOffset/scrollRectToVisible works unexpected after infinite scroll handler invoked at least once #76
Comments
That's super weird. Do you think it can be related to |
I don't think so, I can see the same behavior in iOS 10 too |
What else I can check to probably fix it? |
Another idea is that something is being set up/off incorrectly on the "load more" action when reaching the bottom of content because this contentOffset wrong value has a cumulative nature (i.e. if we "Go up" after only one "load more" we will have 150px mistake, if after 2 - 330, then 479 etc.) and after reaching contentOffset 0;0 by gesture or manuallty tapping "Go up" 2 times then we will have to perform "load more" to make this bug appear again. |
@Aft3rmathpwnz trying to reproduce this. I'll get back to you later. Yeah alright I can reproduce this too. I'll add more logging around to see what and when breaks the animation. |
@pronebird Hey, the reason behind it was that I have a table view and was trying to set contentOffset instead of scrollToRowAtIndexPath:atScrollPosition:animated:. With the last one everything's okay (I got hint from your sources' comment). Why is this happening from technical perspective, do you know? |
@Aft3rmathpwnz I don't exactly recall, since it's been a long time ago when I touched this code last time. But perhaps it has something to do with self-sizing cells and auto-layout. Try disabling self-sizing cells in demo and see if you can reproduce the same issue. |
The same behaviour can be noticed in demo app: add leftNavBarItem "Up", which will handle tap as
tableView.setContentOffset(CGPoint(x: 0, y: -tableView.contentInset.top), animated: true)
for example. Scroll by finger to bottom, wait till fetching will be completed, then tap "Up" button and you will end up with messed
contentOffset
. When I was debugging this in my project I noticed that swizzled methodpb_setContentOffset
wasn't logging last values, i.e.contentSize
was (375, 12000),contentOffset
was (0, 6000), aftersetContentOffset
(orscrollRectToVisivle
with (0,0,tableView.frame.size.width, 1.0)) final log inpb_setContentOffset
was like ±600, and it was the exact position according to View Debugger. Second tap when have an offset of 600 is driving contentOffset to be correct. Any thoughts or workarounds?The text was updated successfully, but these errors were encountered: