Skip to content

GridView dequeues visible cells, i.e. some of my visible cells disappear when I call reloadData #152

acecapades opened this Issue Oct 1, 2012 · 0 comments

1 participant


I'm using GMGridView which is a good open source code that supports grid views.

I have a class named 'ProductsGVC' which presents a grid view of products belonging to a certain 'Category'. ProductsGVC's data model is an array of products taken from an instance of a 'Category'.

My GMGridView creates 250 cells at a time. As I load each cell, I have a thread that downloads an image for each cell. While waiting for it to finish downloading, I put a default image in the cell's image view. Logically, after downloading the cell, I want to reload the cell to update the photo. I'm successful at doing this using this code:

//_currentData is my array of products
[_gmGridView reloadObjectAtIndex:[_currentData indexOfObject:product] animated:YES];
However, if the user decides to see the products of another category, the contents of _currentData is changed so I get errors when I call this line of code.

My inefficient solution is to call[_gmGridView reloadData] anytime a cell finishes downloading its image. The result is, the cells I've loaded before, disappear. I'm guessing their dequeued and reused. Well, they do appear again when I scroll a number of times away from those cells that disappeared.

My question is, how do I prevent dequeue-ing a visible cell or a cell that's currently in use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.