Slide 14
Slide 14 text
UICollectionViewLayout
class UICollectionViewLayout {
class var layoutAttributesClass: AnyClass
class var invalidationContextClass: AnyClass
func prepare()
func layoutAttributesForElements(in rect: CGRect)
func layoutAttributesForItem(at indexPath: IndexPath)
func layoutAttributesForSupplementaryView(ofKind: String, at: IndexPath)
func layoutAttributesForDecorationView(ofKind: String, at: IndexPath)
func shouldInvalidateLayout(forBoundsChange newBounds: CGRect)
func invalidationContext(forBoundsChange newBounds: CGRect)
func shouldInvalidateLayout(forPreferredLayoutAttributes:, withOriginalAttributes:)
func invalidationContext(forPreferredLayoutAttributes:, withOriginalAttributes:)
func targetContentOffset(forProposedContentOffset: CGPoint, withScrollingVelocity: CGPoint)
func targetContentOffset(forProposedContentOffset: CGPoint)
var collectionViewContentSize: CGSize
...
The code here is an example of the UICollectionViewLayout interface. It has many methods. Most people don't know where to start, what we should do.
We don't know the right way, and it is error-prone. So we are forced to trial and error many times. Therefore, an implementation cost becomes too high. I'm pretty sure
that is not what we wanted.