-- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds{
return NO;
}
判定爲佈局需要被無效化並重新計算的時候,佈局對象會被詢問以提供新的佈局。
2.- (void)prepareLayout 系統在準備對item進行佈局前會調用這個方法,我們重寫這個方法之後可以在方法裏面預先設置好需要用到的變量屬;
3.
- (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect爲所有item返回一個layout attributes數組,數組中元素的類型爲UICollectionViewLayoutAttributes。UICollectionViewLayoutAttributes記錄了一個layout的位置、大小、透明度等信息。
4.
- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath (可選)
爲一個特定的item返回layout attribute。注意,返回的attribute僅使用cell,不包括supplementary view和decoration view。