Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

performance - Change UIScrollView scroll speed

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

scroll.pagingEnabled = YES;


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...