保留图像阵列 [英] Persisting an array of images

查看:53
本文介绍了保留图像阵列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在应用重新启动时保存和检索一系列图像的最佳方法是什么?我正在实现一种缓存功能,用于脱机查看下载的图像,并且只想确保我使用的是正确的持久化方法.

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 methods.

谢谢!

推荐答案

最快的&毫无疑问,最好的解决方案是将映像持久保存到磁盘.

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

您可以执行以下操作将其另存为JPEG.

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

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

这篇关于保留图像阵列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆