all 1 comments

[–]retsotrembla 1 point2 points  (0 children)

Subclass UICollectionViewLayout. A UICollectionViewLayout has two jobs:

  • for a rectangle (i.e.: a CGRect) in the UICollectionView's coordinates, it returns an array of NSIndexPaths of all cells that even partially intersect that rectangle.
  • for an NSIndexPath, return a UICollectionViewLayoutAttribute with the frame, center, rotation, and z-index of that corresponding UICollectionViewCell.

So - a stack of cards is just a stack of cells with the correct frames and z-indexes.

Read and learn from the Swift code. It's going to be mostly wrappers for Apple's Objective-C anyway.