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:
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?
If that’s a little overpowered, you might want to check out MWPhotoBrowser — A simple iOS photo browser