开发者

How would you add a lot of images to an UIview?

开发者 https://www.devze.com 2022-12-22 18:24 出处:网络
I have to put a lot of images (>100) to a UIView, with touch detection. If I use UIImageViewController I have ran out of memory. I\'ve tried to draw the images manually, but in that case I can\'t d

I have to put a lot of images (>100) to a UIView, with touch detection. If I use UIImageViewController I have ran out of memory. I've tried to draw the images manually, but in that case I can't detect which image has been p开发者_StackOverflowushed.

So how would you do this?


For a simple solution, you might want to try creating thumbnail sized images to display that will take up much less memory (100 times 32 pixels x 32 pixels x 4 channels is definitely small enough for the iPhone to handle). For a more robust solution, you want to look at doing lazy loading and only keep in memory those images that are currently being displayed. There is a great example of this in a CoverFlow clone found in Ch 12 of iPhone SDK Application Development, which you can see here

0

精彩评论

暂无评论...
验证码 换一张
取 消