Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Much Improved Apple PhotoScroller

DZone's Guide to

Much Improved Apple PhotoScroller

· Mobile Zone
Free Resource

Launching an app doesn’t need to be daunting. Whether you’re just getting started or need a refresher on mobile app testing best practices, this guide is your resource! Brought to you in partnership with Perfecto

Now this looks worth a serious look if you need to drop a downloadable photo gallery in somewhere — and who doesn’t?

Apple’s PhotoScroller sample code for iOS looks to many as a perfect starting place to display a scrolling list of photos that can each be zoomed significantly. It uses a CATiledLayer as a backing store so it does not have to load whole images into memory.

That said, after you see the three pretty jpeg images in the project, you lift up the covers and find approx 800 pre-tiles png files – its the pretiling of the jpegs that makes this project work.


Why, yes. Yes, we had noticed that.

So, I’ve taken that project and greatly enhanced it:

https://github.com/dhoerl/PhotoScrollerNetwork


And enhanced how? For instance,

- blazingly fast tile rendering – visually much much faster than Apple’s code (which uses png files in the file system)

- you supply a single jpeg file or URL and this code does all the tiling for you, quickly and painlessly

- provides the means to process very large images for use in a zoomable scrollview

- is backed by a CATiledLayer so that only those tiles needed for display consume memory

- each zoom level has one dedicated temp file rearranged into tiles for rapid tile access & rendering

- demonstrates how to use concurrent NSOperations to fetch several large images from the web or to process local image files

- the incremental approach uses mmap, only maps small parts of the image at a time, and does its processing as the image downloads and can thus handle very large images


That’s a pretty handy set of features for your large image display needs, isn’t it now?


Source: http://www.alexcurylo.com/blog/2012/02/27/photoscrollernetwork/

Keep up with the latest DevTest Jargon with the latest Mobile DevTest Dictionary. Brought to you in partnership with Perfecto.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}