AQGridView icon indicating copy to clipboard operation
AQGridView copied to clipboard

Best Practices for reloading one cell & performance issues

Open ralphleon opened this issue 12 years ago • 1 comments

Hi,

I have a large amount of cells (say 1000) that all have 512x512 images loaded into them from the local cache (~/Library/Cache). Loading the images in:

- (AQGridViewCell *) gridView: (AQGridView *) aGridView cellForItemAtIndex: (NSUInteger) index

via [UIImage imageWithContentsOfFile ...] is understandably locking the main thread, so I have a background thread loading the cells images. When this thread (actually a GD queue) finishes loading the image (the core graphics way to not block the thread) I attempted to have it call [_grid reloadData] but this too introduced lag.

Currently I use

   if([[_gridView visibleCellIndices] containsIndex:index]){
        NSIndexSet * s = [NSIndexSet indexSetWithIndex:index];
        [_gridView reloadItemsAtIndices:s withAnimation:AQGridViewItemAnimationNone];
    }

to attempt to manually reload the image for one cell... but this sometimes throws the ominous warning of:

 Visible cell list is missing some items!
 Got 16 missing indices

So, what I'm getting at is what's the best practices for dealing with lazy image loading an AQGridView?

ralphleon avatar Mar 14 '12 17:03 ralphleon

having same issue... pls help me.....

jignesh133 avatar Dec 06 '13 14:12 jignesh133