Reputation: 35
I'm working on an iPhone app using a core data store with about 100 entities, each with the following attributes: a few strings, a small thumbnail image, and the full-size image (stored in an External Record File via Core Data).
These are loaded into a Fetched Results Controller for use in a table view. To increase loading speed and decrease memory usage, how can I prevent the full-size image from being fetched until after a cell is selected?
I'm very new to Core Data, but would a Fetched Property be of use here?
Thanks so much for your help!
Upvotes: 2
Views: 106
Reputation: 77641
I have done this before by moving the image into its own Entity
in the model and adding a relation back to the original object.
The new object will be something like...
Image
----------
image (binary data) - store externally (same as the current image)
----------
object - relation to the original object
Then just replace the attribute in the original entity to a relation.
The FRC will then only load the objects and then when you do... object.image
it will then get the image object that you can get the image out of.
Upvotes: 2