开发者

Core Data save UIImage

I have a Core Data in this database should I save images, so how can do to save an image that is just takes URL ... 开发者_如何学CExample please


Large images (>100 kb) should not be saved in CoreData, as it would really increase your managed object's memory footprint.

For these images I would save the path in CoreData as a string or an URL and then load the image if you need it.

In principle you can save anything as an attribute in a CoreData entity if it can be archived into a NSData object. There are examples in the CoreData documentation of how to save a UIColor to the database which uses exactly this technique.

Check out the CoreRecipes sample code in which an image is attached to each recipe. This is basically the same thing you want to do.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜