-
Notifications
You must be signed in to change notification settings - Fork 0
/
DLZWaterFallLayout.h
43 lines (29 loc) · 1.14 KB
/
DLZWaterFallLayout.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// DLZWaterFallLayout.h
// DLZCollectionViewLayout
//
// Created by 董力祯 on 2017/12/8.
// Copyright © 2017年 董力祯. All rights reserved.
//
#import <UIKit/UIKit.h>
@class DLZWaterFallLayout;
@protocol DLZWaterFallLayoutDelegate <NSObject>
@required
//计算item高度的代理方法,将item的size与indexPath传递给外界
- (CGSize)dlzCollectionViewLayout:(DLZWaterFallLayout *)dlzLayout atIndexPath:(NSIndexPath *)indexPath;
@end
@interface DLZWaterFallLayout : UICollectionViewLayout
#pragma mark- 属性
//总共多少列,默认是2
@property (nonatomic, assign) NSInteger columnCount;
//列间距,默认是0
@property (nonatomic, assign) NSInteger columnSpacing;
//行间距,默认是0
@property (nonatomic, assign) NSInteger rowSpacing;
//section与collectionView的间距,默认是(0,0,0,0)
@property (nonatomic, assign) UIEdgeInsets sectionInset;
//代理,用来计算item的高度
@property (nonatomic, weak) id<DLZWaterFallLayoutDelegate> delegate;
//计算item高度的block,将item的高度与indexPath传递给外界
@property (nonatomic, strong) CGSize(^itemSizeBlock)(NSIndexPath *indexPath);
@end