I have a collection view where the cells contain UIImageView
s, and I'm trying out adding a label as a subview to these views. The problem is that since the cells are reusable, labels keep getting added. I can, of course, check whether my label already exists and reuse it, but I'd really like to clean up after myself. Is there a way to tell when the cell disappears and remove the label then? I've looked at the various docs and don't find any methods that seem promising. Maybe I'm just missing it.
Delegate method: collectionView:didEndDisplayingCell:forItemAtIndexPath:
But you should probably just create a custom cell and reuse instead of creating and destroying...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With