Last Updated: February 25, 2016
·
4.801K
· brianmichel

UICollectionViewLayoutAttributes Subclass

If you're using a custom subclass of UICollectionViewLayoutAttributes, you have to implement copyWithZone: to make sure your currently set values get copied over.

It seems that the UICollectionViewLayout may copy the attributes you pass back in layoutAttributesForElementsInRect: before applying them to the UICollectionViewCell.

Here's a sample project demonstrating the point, CollectionViewAttributesTest.