- 設(shè)置幾個(gè)區(qū)
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView;
- 每個(gè)區(qū)里有幾個(gè)item
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section;
- 每個(gè)區(qū)的layout類(lèi)型
- (ZLLayoutType)collectionView:(UICollectionView *)collectionView layout:(ZLCollectionViewFlowLayout *)collectionViewLayout typeOfLayout:(NSInteger)section;
- 創(chuàng)建每個(gè)item的cell货葬,設(shè)置cell數(shù)據(jù)氏仗、屬性
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath ;
- PercentLayout代理,指定每個(gè)item的寬度percent踊挠。item的寬度percent之和在=1之前不能>1。默認(rèn)return 1
- (CGFloat)collectionView:(UICollectionView )collectionView layout:(ZLCollectionViewFlowLayout)collectionViewLayout percentOfRow:(NSIndexPath*)indexPath;
- 每個(gè)item的size
- (CGSize)collectionView:(UICollectionView )collectionView layout:(UICollectionViewLayout)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath;
返回?cái)?shù)值 | Layout枚舉 | 描述 |
---|---|---|
return 寬高 | LabelLayout | |
FillLayout | 嚴(yán)格根據(jù)size布局 | |
return高 | PercentLayout | 只需指定size的高度 |
ClosedLayout | 只需指定size的高度广匙,等分width為幾份 |
- ClosedLayout 設(shè)置列數(shù)
- (NSInteger)collectionView:(UICollectionView )collectionView layout:(ZLCollectionViewFlowLayout)collectionViewLayout columnCountOfSection:(NSInteger)section;
- AbsoluteLayout 設(shè)置rect
- (CGRect)collectionView:(UICollectionView )collectionView layout:(ZLCollectionViewFlowLayout)collectionViewLayout rectOfItem:(NSIndexPath*)indexPath;
- AbsoluteLayout 設(shè)置zIndex
- (NSInteger)collectionView:(UICollectionView *)collectionView layout:(ZLCollectionViewFlowLayout )collectionViewLayout zIndexOfItem:(NSIndexPath)indexPath;
- 為每個(gè)item設(shè)置transform
- (CATransform3D)collectionView:(UICollectionView *)collectionView layout:(ZLCollectionViewFlowLayout )collectionViewLayout transformOfItem:(NSIndexPath)indexPath;
- 指定上下item的space
- (CGFloat)collectionView:(UICollectionView )collectionView layout:(UICollectionViewLayout)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section;
- 指定左右item的space
- (CGFloat)collectionView:(UICollectionView )collectionView layout:(UICollectionViewLayout)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section;
- 指定section內(nèi)的edgeInset
- (UIEdgeInsets)collectionView:(UICollectionView )collectionView layout:(UICollectionViewLayout)collectionViewLayout insetForSectionAtIndex:(NSInteger)section;
- 區(qū)頭也是ReusableView
- (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath;
- 區(qū)頭size
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section;
- 區(qū)頭背景view是這么設(shè)置的
- (NSString*)collectionView:(UICollectionView *)collectionView layout:(ZLCollectionViewFlowLayout *)collectionViewLayout registerBackView:(NSInteger)section;
- 區(qū)頭view load的時(shí)候
- (void)collectionView:(UICollectionView *)collectionView layout:(ZLCollectionViewFlowLayout *)collectionViewLayout loadView:(NSInteger)section;
- 區(qū)頭背景顏色
- (UIColor*)collectionView:(UICollectionView *)collectionView layout:(ZLCollectionViewFlowLayout *)collectionViewLayout backColorForSection:(NSInteger)section;
- 區(qū)頭背景是否延伸覆蓋到區(qū)頭月培,默認(rèn)為NO
- (BOOL)collectionView:(UICollectionView *)collectionView layout:(ZLCollectionViewFlowLayout *)collectionViewLayout attachToTop:(NSInteger)section;