Setting ContentOffset for UIScrollView when scrolling

This is the first question I asked here, so bear with me


. I studied this a lot, but could not find a solution that worked, so I decided that I would give it up.

I am using UIScrollView to try to display a bunch of UIImageViews.

I have 20 UIImageViews loaded in a scroll list at any given time. What I'm doing at the moment to show more than just 20 photos is to update UIImageViews with new UIImages every time it reaches a specific ContentOffset. Whenever a user scrolls past a ContentOffset of 95, the offset is reset to 0 and new images are loaded. I chose a number that created the illusion of continuous scrolling, so the user does not see a reload / reset of the view. The same thing happens when you scroll up to 0.

My problem is that when you view the UIScrollView (so that it keeps scrolling by itself), it looks like the ContentOffset is not reset as intended. The view itself is reset correctly and for the 1st iteration, the offset is 0, but at the next iteration (after a few seconds) the offset increases to 120 or 130, and it jumps as if I had reached the end of the next screen.

Does anyone know how to properly reset ContentOffset while scrolling UIScrollView?

+3
source share
1 answer

-, , . , , ? ( )

+1

Source: https://habr.com/ru/post/1787793/


All Articles