I have a UICollectionView which uses UICollectionViewDelegateFlowLayout. I’ve added a method which changes the layout when tapping a cell setCollectionViewLayout.
All the cells have a text label with text and I would like to empty all the text labels on every cell when changing the layout. What’s the best way to accomplish that?
Thanks,
I would imagine the simplest way is just to call
reloadDataon your collection view at the same time that you change the layout (and have a conditional in yourcellForItemdata source method that empties the text labels upon each layout change).Alternatively, you could have your
UICollectionViewCellskeep track of the layout they’re currently displayed in, and adjust their views accordingly.