Note that there are some explanatory texts on larger screens.

plurals
  1. POMemory trouble with iCarousel and images from coredata
    primarykey
    data
    text
    <p>I have a basic implementation for iCarousel where I am pulling images from a core-data store. I am experiencing memory related crashes when you get a lot of images loaded, as I guess is expected. The problem is I don't know of any way to use the AsyncImageView library since there is no NSURL reverence for a core-data object. Anyone know another way to manage this memory issue?</p> <p>Here is my iCarousel viewForItemAtIndex</p> <pre><code>- (UIView *)carousel:(iCarousel *)carousel viewForItemAtIndex:(NSUInteger)index reusingView:(UIView *)view { JournalEntry *journalEntry = (JournalEntry *)[fetchedResultsController objectAtIndexPath:[NSIndexPath indexPathForRow:index inSection:0]]; if (view == nil) { view = [[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 240.0f, 240.0f)] autorelease]; view.contentMode = UIViewContentModeScaleAspectFit; } [((UIImageView *)view) setImage:[journalEntry.image valueForKey:@"image"]]; NSLog(@"%i", index); return view; } </code></pre> <p>For reference here is code for adding images to my core-data store straight out of the iPhoneCoreDataRecipes sample code.</p> <pre><code>@implementation ImageToDataTransformer + (BOOL)allowsReverseTransformation { return YES; } + (Class)transformedValueClass { return [NSData class]; } - (id)transformedValue:(id)value { NSData *data = UIImagePNGRepresentation(value); return data; } - (id)reverseTransformedValue:(id)value { UIImage *uiImage = [[UIImage alloc] initWithData:value]; return [uiImage autorelease]; } @end </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload