I\'ve noticed that when calling setLayout:animated
in a UICollectionView
to switch between two layouts, the currently visible cell doesn\'t adhere to t
Using @sampage & @grimfrog answers as a starting point, I was able to get a similar situation working
- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)path
{
UICollectionViewLayoutAttributes* attributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:path];
attributes.zIndex = path.item;
attributes.transform3D = CATransform3DMakeTranslation(0, 0, path.item);
// other attribute settings
return attributes;
}
My layoutAttributesForElementsInRect:
calls layoutAttributesForItemAtIndexPath:
when generating the attribute array - so I only needed to include the zIndex and transform3D there.