steipete/PSTCollectionView — pull request #307 by jlnr (2013-05-14 11:53:31+00:00)
Title: Fix -[PSTCollectionViewCell applyLayoutAttributes:] (hopefully)

In our app, we have implemented `finalLayoutAttributesForDisappearingItemAtIndexPath:` to discard deleted cells with a rotation & translation. These animations broke when we upgraded to PSTCollectionView 1.0.0 recently. I have been able to track it down to this commit:

https://github.com/steipete/PSTCollectionView/pull/263

This commit has indeed fixed the LineLayout example where cells are scaled, but at the cost of breaking rotations. This can be verified by changing the method `-[LineLayout layoutAttributesForElementsInRect:]` in the example, changing this line:

```
attributes.transform3D = CATransform3DMakeScale(zoom, zoom, 1.0);
```

...into this:

```
attributes.transform3D = CATransform3DMakeRotation(zoom - 1, 0.0, 0.0, 1.0);
```

The result is distorted on iOS 5 because the `CGRectApplyAffineTransform` function changes the size of the cell when it should have the same area, just with a rotation applied.

I think changing the `bounds` rect is the way to go - this works in the LineLayout example (with and without the modification above), in our app, and has not broken any of the other examples as far as I could see.

As an added bonus, `PSTCollectionViewCell` transforms are not limited to affine transforms now :)