Change UIScrollView scroll speed

performancescrolluiscrollview

In my app I have a view that extends UIScrollView and populates its content as the user scrolls. However, if the user scrolls too fast the views being populated inside the UIScrollView don't get created on time and you can actually see the UIScrollView's background. The reason why this happens is because I'm doing this lazy loading in the layoutSubviews doesn't seem to get called every time the contentOffset property is changed.

If you scroll the UIScrollView slowly you don't run into the problem I described above and the content is loaded quickly enough.

The only solution to this problem that I can think of is by making it so the UIScrollView doesn't scroll faster than a certain speed when the user lifts up his finger from the screen.

Just so you know changing the decelerationRate property isn't my solution. DecelerationRate tells the UIScrollView how fast it needs to stop scrolling after the user lifts up the finger.

Best Answer

scroll.pagingEnabled = YES;