Reputation: 3612
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,
Upvotes: 1
Views: 6705
Reputation: 31304
I would imagine the simplest way is just to call reloadData
on your collection view at the same time that you change the layout (and have a conditional in your cellForItem
data source method that empties the text labels upon each layout change).
Alternatively, you could have your UICollectionViewCells
keep track of the layout they're currently displayed in, and adjust their views accordingly.
Upvotes: 3