I am currently working on an iOS application that I allow the user to add images from their photo library into the application. I store these images on the devices file system, and access them when I need them (when they are in a UIScrollView, I could access them quite often)
I just wanted to get some opinions on this approach. Should I stay with the file system method, or would it be beneficial to store these I images in CoreData instead.
Any suggestions on this would be greatly appreciated.
Thanks.
I don’t think Core Data was really designed for storing this type of data. Doing so would be the moral equivalent of storing the image data into a SQL/relational database which isn’t ideal either.
I have a similar situation where I have a bunch of images stored in hard targetted location (my image list never changes, so I just include them all in the application bundle) with a Core Data store that contains a lot of metadata about the images. All I keep in the Core Data of the image itself is the file name and then mash together the full file path during runtime when it is finally time to see the image. I don’t have any problems with lag time or delays.
Even though I’m not showing the images in a UIScrollView, I still think you’d have little problem fetching the array of image information from the Core Data store and generating the full file path on the fly as cells are generated since those are just strings and the code for generating the UIImage is very compact. That or generate the same array of information, and then compiling an array of image paths before any cells are generating, like when the UIScrollView is just about to appear.