- (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds;

-- (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。


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章