AQGridView icon indicating copy to clipboard operation
AQGridView copied to clipboard

New image/cell doesn't appear on reloadData until scrolled

Open zakdances opened this issue 12 years ago • 6 comments

I have an AQGrid which is loading a grid of images. When the data array is changed and reloadData is called on the grid, nothing happens UNTIL the grid is scrolled, at which point the cell is added and appears correctly. What's going on?

zakdances avatar May 13 '12 00:05 zakdances

Post code.

On May 13, 2012, at 8:28, zakdances [email protected] wrote:

I have an AQGrid which is loading a grid of images. When the data array is changed and reloadData is called on the grid, nothing happens UNTIL the grid is scrolled, at which point the cell is added correctly. What's going on?


Reply to this email directly or view it on GitHub: https://github.com/AlanQuatermain/AQGridView/issues/133

evadne avatar May 13 '12 08:05 evadne

Here's my subclasses of AQGridView and AQGridViewCell, respectively:

kzArtGridController.h https://docs.google.com/document/d/1pLjZWACFTzsVl95Zi9OuQsNLOsqwsHJi4TFrzA7LBNo/edit

kzArtGridController.m: https://docs.google.com/document/d/1RUDvV6Tw_2OmlyCIoFgvUjGQ9gdgO0eOzzLb8bkWOpY/edit

kzImageGridViewCell.h: https://docs.google.com/document/d/1OMPTkOQw8r8klEMgmSZMnmIL4JPZo7t3WCv9gHXEF9o/edit

kzImageGridViewCell.m: https://docs.google.com/document/d/1DKFySwxAP1am4VHDQZlBLkz0x_3EpK-tqiA6YhQ4ys4/edit

I can't figure out why the grid doesn't show the new cell when reloadData is called. Can you see a problem here or is this a bug?

zakdances avatar May 17 '12 11:05 zakdances

Still having this same issue...is anyone else seeing this problem? Can anyone lend a hand?

zakdances avatar May 25 '12 06:05 zakdances

I'm having the same issue. Cells don't always refresh until the user scrolls. Sometimes, one or two cells will refresh when reloadData is called but not all of the cells get updated until a scroll is performed. Any help is greatly appreciated.

sogwiz avatar Dec 09 '12 20:12 sogwiz

Update: So I found a solution that likely isn't elegant. It's described here.

http://stackoverflow.com/questions/5945325/uitableview-layout-not-refreshing-until-scrolled "In your CellForRowAtIndex delegate and don't check if the cell equals nil just keep going."

The solution, described for a UITableView, can also apply to the AQGridView. This doesn't seem optimal but it does work for me. I love AQGridView!

sogwiz avatar Dec 09 '12 20:12 sogwiz

Hey Sogwiz,

Thank you so much for the link. However, I still can't see that the issue is fixed for me. I have a feeling that I am implementing it wrong.

Would you be able to upload the code you changed so I and anyone else who comes across this issue can solve it from here.

Thanks again.

ghost avatar Dec 10 '12 00:12 ghost