I've seen the WDC2010 Session 104 for using scrollviews and CATiledLayers, which is all pretty cool. But I'm not sure about the generation of the tile images. The example had the frog tile pictures already created. But if I have a photo app where I am taking my own photos, I will need to create the tiles myself and I'm not sure of the best approach to take.
Easiest method would be as soon as I take a photo and store it, I do some image manipulation and create all the possible tiles I need. But that means for every photo, I'm storing a lot more files and using more file space.
Just before I need the photo, I create the tiles into a temp directory. When I've finished the viewing part I can delete that temp directory. At least I'm only using the extra file space when viewing the photos. But I'd be concerned about loading the image to create tiles as to whether I introduce a delay which is noticeable to the user.
You wouldn't need to save off the tiled images. Basically, you would create the UIImage/CGImage based on the rect being displayed.
I have done something similar here and it works quite well, the bonus is that it is very efficient with memory. I dynamically generate the CGImage (the small tile from the large image) based on the rect being displayed and the TiledLayer removes it from memory when it dumps the rect. I never save the CGImage to a file.
The disadvantage with this approach is that it introduces latency in the rendering... Not good for games on an iphone 3g.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With