将图像存储在核心数据和视网膜显示器中?
我有一个应用程序,有数百个单词,每个单词有 3/4 个图像。 每个词我都有 2 个版本,一个用于 iOS 3,一个用于视网膜显示。 我希望将图像保存为数据并将它们连接到适当的单词,以便以后可以轻松提取它们。
我的问题是 - 我如何获得合适的尺寸? 它与 @2x wjen 配合得很好,你从应用程序文件系统获取它,但是当我从数据获取它时它应该工作吗?
谢谢 沙尼
I have an app that has hundreds of words with 3/4 images for each word.
I have 2 versions of each word one for iOS 3 and one for retina display.
I wish to save the images as data and connect them to the appropriate word so it will be easy to pull them later.
my question is -
how do i get the suitable size ?
its works great with the @2x wjen you get it from the app file system, but hoe does it supposed to work when i get it from data ?
thanks
shani
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将图像存储在 CoreData 中是一个相当不明智的想法。当包含图像的对象出错时,它会显着增大 CoreData 数据库的大小并导致内存问题。相反,您应该将图像写入文件系统并将图像路径存储在 CoreData 中。
Storing images in CoreData is a rather ill-advised idea. It will significantly bloat the size of the CoreData database and cause memory issues when you have faulted-in objects containing images. Instead you should write the images out to the filesystem and store the image path in CoreData.
使用 Core Data 保存图像并不罕见。
查看示例 iPhoneCoreDataRecipes 查看 Apple 如何将图像作为可转换类型存储在 Core Data 中。
It's not quite unusual that you save the images with Core Data.
Take a look at the sample iPhoneCoreDataRecipes to see how Apple stores the images in Core Data as Transformable Type.