-1

The app that I am working on right now centers on a UITableView (with custom cells) that loads data from a Core Data database. Each entity has a few NSStrings, a binary data attribute with a compressed resized UIImage, and a transformable UIImage attribute, stored externally. The app runs fabulously with just the compressed resized image saved, but when I save the full image to the transformable attribute as well, the table view becomes slow and I receive memory warnings. I should mention that the only things actually in the cells are just two NSStrings and the jpeg representation of the compressed resized image.

Why is the full sized image that is stored externally still slowing down the table view when it is not being accessed, and what can I do to fix this?

Andrew
  • 479
  • 1
  • 5
  • 13
  • define "stored externally" and "not being accessed". – Kreiri Jul 07 '13 at 23:24
  • Stored externally - in the Data Model Attribute Inspector, there is a checkmark next to "Store in External Record File." I have read that this is recommended when storing a UIImage in Core Data. Not being accessed - I do not have any code telling the full sized UIImage to be displayed or otherwise manipulated. It is in the entity for another purpose, not meant to be used in the table view. – Andrew Jul 07 '13 at 23:26

1 Answers1

0

It is recommended to store images on the filesystem and maintain path references in Core Data.

Loading images to memory is expensive, so do this on a background thread before delivering to the main thread. You can maintain a stack for image loading, useful for when the user is scrolling rapidly as the visible cells will be prioritised for free.

Beyond this generic advice there isn't much more that can be said, you really haven't given us much to go on (no code, no image metadata such as size and so forth).

Ken
  • 30,811
  • 34
  • 116
  • 155
  • Would the second code snippet in the second response to this question be the appropriate way to save to the file system http://stackoverflow.com/questions/6238139/ios-download-and-save-image-inside-app ? – Andrew Jul 07 '13 at 23:50
  • It depends how important those images are; if the user created these in your app then consider putting these in documents, otherwise use the cache directory. – Ken Jul 08 '13 at 00:23