I'd like to present and allow the user to zoom large images on the iPhone and iPad in much the same way that the Photos app works.
I realize CATiledLayer is the goto class for this, but the aesthetic it uses won't work for my application. It renders tiles one after another, while the Photos app renders the whole screen at once (and shows a pixellated version during and after a zoom until the app can catch up).
I could certainly implement a view which renders the image in the background after each zoom. However, once the source image gets to large, this will crash the app. So tiling is appealing, I would just prefer to not update the screen until all tiles are ready (and show a lower-res image in the meantime).
Has anyone tried to implement something like this? Any ideas?
I guess you can have two views: one ImageView with a low res image, and on top a custom view with a CaTiledLayer, with transparent background and hidden at the beginning.
So, when zooming (you'll need to apply zoom to both views) and you need extra resolution, just show the catiledlayered view, so it will load tiles while showing the lowres (and pixelated) on not loaded tiles.
Apple's PhotoScroller and ScrollViewSuite samples show how to do this and more.
- http://developer.apple.com/library/ios/#samplecode/PhotoScroller/Introduction/Intro.html
- http://developer.apple.com/library/ios/#samplecode/ScrollViewSuite/Introduction/Intro.html
There's also a 2010 WWDC video titled "Designing Apps with Scroll Views" that explains PhotoScroller.
来源:https://stackoverflow.com/questions/8996268/present-and-zoom-large-images-on-ios-without-catiledlayer