开发者

Persisting an array of images

开发者 https://www.devze.com 2023-01-18 10:04 出处:网络
What\'s the best way to save and retrieve an array of images across app restarts? I\'m implementing a caching feature for offline viewing of downloaded images and just want to make sure I\'m using the

What's the best way to save and retrieve an array of images across app restarts? I'm implementing a caching feature for offline viewing of downloaded images and just want to make sure I'm using the right persisting me开发者_JAVA技巧thods.

Thanks!


The quickest & probably best solution would be to persist your images to disk, no question about it.

You could do something like this to save them as JPEG.

NSData *data = UIImageJPEGRepresentation(image, 1.0f);
[data writeToFile:imagePath atomically:YES];
0

精彩评论

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