KKGridView icon indicating copy to clipboard operation
KKGridView copied to clipboard

Cell's contentView contents duplicated. Cells not dequeuing or reusing correctly.

Open viewDidAppear opened this issue 12 years ago • 3 comments

Driving me mad. I use the recommended Example (on the front page) for cellForItemAtIndexPath, and in my cell creation, I add a Label subview because I require text to be shown on the bottom of the cell.

Only problem is, when I scroll it will visibly stutter, and when I return, there are duplicates of the text (and assumably the image too) on every cell. Leaving the grid view slow, unresponsive and unpleasant to use. I really don't want to have to go find another one.

Any ideas?

viewDidAppear avatar Nov 06 '12 12:11 viewDidAppear

This method will always return something, similar to the new UITableView method. If you add subview every time it's called, you'll get a million subviews. Add them only in your sub class's init method and set values on the properties "cell.textLabel.text = ..."

Sent from my iPhone

On Nov 6, 2012, at 4:04, cocotutch [email protected] wrote:

Driving me mad. I use the recommended Example (on the front page) for cellForItemAtIndexPath, and in my cell creation, I add a Label subview because I require text to be shown on the bottom of the cell.

Only problem is, when I scroll it will visibly stutter, and when I return, there are duplicates of the text on every cell. Leaving the grid view slow, unresponsive and unpleasant to use. I really don't want to have to go find another one.

Any ideas?

— Reply to this email directly or view it on GitHub.

kolinkrewinkel avatar Nov 06 '12 16:11 kolinkrewinkel

So I have to subclass KKGridViewCell to set my imageView and textLabel properties?

viewDidAppear avatar Nov 07 '12 02:11 viewDidAppear

Setting the image should not call multiple times. The grid view should not be glitchy when you scroll by any means. I have tried to set up my cellForItemAtIndexPath: method like a normal UITableViewCell method, with "if(cell==nil)" conditionals, where I create any necessary subviews, and inside the else statement I grab the view by its tag.

Beneath the entire conditional, I set the property of the textLabel subview and the imageView that was already found upon the cell.

How can I possibly be going wrong?

viewDidAppear avatar Nov 07 '12 05:11 viewDidAppear