Search code examples
ipadaqgridviewreuseidentifier

Prevent a cell from being reused in AQGridView


I am using AQGridView for a grid of images.I need to overlay a progress bar over a particular image which is being downloaded. The problem is, if I scroll that Image cell out of view, the progress bar appears on another cell as well. I think this is because cell is being reused.

Is there a way i can mark certain cells from being reused?


Solution

  • Please don't do that. You should update your cell in - gridView:cellForItemAtIndex:, which gets called for every cell that becomes visible.

    Something like:

    - (AQGridViewCell *)gridView:(AQGridView *)aGridView cellForItemAtIndex:(NSUInteger)index
    {
         AQGridViewCell *cell;
    
         // dequeue cell or create if nil
         // ...
    
         MyItem *item = [items objectAtIndex:index];
         cell.progressView.hidden = !item.downloading;
    
         return cell;
    }