Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lazy load pages in UIScrollView

I have a UIScrollView that contains large images and am using paging to scroll between images. In order to save memory, I am loading only one image before and after the currently visible one and loading/releasing new images after a scroll has completed.

The problem occurs when one scrolls quickly and scrollViewDidEndDecelerating is not called.

How can I detect continuous scrolling?

I could check item location on every scrollViewDidScroll but this seems a bit heavy...

like image 902
jean Avatar asked Apr 03 '10 20:04

jean


People also ask

What is lazy loading in web page?

Lazy loading is a strategy to identify resources as non-blocking (non-critical) and load these only when needed. It's a way to shorten the length of the critical rendering path, which translates into reduced page load times.

Does lazy load improve page speed?

Applying lazy loading to your page content has many potential advantages: It helps your page load faster. This improves the visitor experience, increases the number of engaged visitors and conversions, and helps your SEO. It reduces data usage since the browser loads a fraction of the total page content per visit.

How do I fix lazy loading?

The majority of web browsers support lazy loading, but lazy loading is not a perfect solution. The solution is to use an API to detect images entering the viewport. Add a margin to images. You can define the margin by setting a bounding box via the rootMargin.

What is lazy load example?

For example, if a web page has an image that the user has to scroll down to see, you can display a placeholder and lazy load the full image only when the user arrives to its location.


1 Answers

Perhaps a table view with custom cell content would work better for you, since it has a lot of logic built in for only loading cells that are visible as opposed to everything at once. There are lots of tutorials for how to manage table views in various ways.

like image 191
Yetanotherjosh Avatar answered Oct 20 '22 00:10

Yetanotherjosh