Reputation: 29896
I have a UITableView which I use to display images in a grid form. 4 images per row.
The problem I have now is that the overlay which I have to display when an image is selected. (see image). The overlay is removed, or the image is hidden when the tableview scrolls down. The images are still selected, but the overlay is hidden.
How can the tableview be stopped from removing the overlay image when the image is scrolled out of bounds.
after scrolling the images out of view and back in the image overlays are gone, but images are still selected.
Upvotes: 0
Views: 290
Reputation: 3655
This is because when you scroll the "GetCell" method is being called, which causes all the cells to be redrawn (hence why you're "losing" the selection).
When you select an image, you'll need to keep a reference to that image and cell. In the GetCell method, you can then check to see whether the cell to be drawn contains any selected images, if so, ensure that image is drawn as "selected".
Upvotes: 1