@@ -102,6 +102,7 @@ @implementation FMCombineViewController
102102
103103- (void )viewDidLoad {
104104 [super viewDidLoad ];
105+
105106 FMLayoutView *view = [[FMLayoutView alloc ] init ];
106107 // view.layout.minContentSize = 1000;
107108 view.backgroundColor = [UIColor whiteColor ];
@@ -115,11 +116,13 @@ - (void)viewDidLoad {
115116 // [self addCrossFixedSections];
116117// [self addScaleSection];
117118 self.collectionView .enableLongPressDrag = YES ;
118- [self .collectionView setConfigureSourceView: ^UIView * _Nonnull (UICollectionViewCell * _Nonnull sourceCell) {
119- UIView *source = [[UIView alloc ] initWithFrame: sourceCell.frame];
120- source.backgroundColor = [UIColor purpleColor ];
121- return source;
122- }];
119+ // [self.collectionView setConfigureSourceView:^UIView * _Nonnull(UICollectionViewCell * _Nonnull sourceCell) {
120+ // UIView *source = [[UIView alloc] initWithFrame:sourceCell.frame];
121+ // source.backgroundColor = [UIColor purpleColor];
122+ // return source;
123+ // }];
124+
125+ self.navigationItem .rightBarButtonItem = [[UIBarButtonItem alloc ] initWithTitle: @" 刷新" style: UIBarButtonItemStylePlain target: self .collectionView action: @selector (reloadData )];
123126}
124127
125128- (void )addSections {
@@ -143,17 +146,18 @@ - (void)addSections{
143146 section.footer .topMargin = 10 ;
144147
145148 section.itemSize = CGSizeMake (200 , 100 );
146- section.itemDatas = [@[@" 1" , @" 2" , @" 3" ] mutableCopy ];
149+ section.itemDatas = [@[@" 1" , @" 2" , @" 3" , @" 4 " , @" 5 " , @" 6 " , @" 7 " , @" 8 " , @" 9 " ] mutableCopy ];
147150 section.cellElement = [FMLayoutElement elementWithViewClass: [FMCollectionViewCell class ] isNib: YES ];
148151 [section setConfigureCellData: ^(FMLayoutBaseSection * _Nonnull section, UICollectionViewCell * _Nonnull cell, NSInteger item) {
149-
152+ [(FMCollectionViewCell *)cell label ]. text = section. itemDatas [item];
150153 }];
151154
152155 [section setClickCellBlock: ^(FMLayoutBaseSection * _Nonnull section, NSInteger item) {
153156 FMAddViewController *add = [[FMAddViewController alloc ] init ];
154157 [weakSelf.navigationController pushViewController: add animated: YES ];
155158 }];
156159
160+ section.canLongPressExchange = YES ;
157161 [sections addObject: section];
158162 }
159163 {
@@ -162,10 +166,10 @@ - (void)addSections{
162166 FMLayoutFixedSection *section = [FMLayoutFixedSection sectionWithSectionInset: UIEdgeInsetsMake (0 , 0 , 0 , 0 ) itemSpace: 10 lineSpace: 10 column: 2 ];
163167
164168 section.itemSize = CGSizeMake (150 , 100 );
165- section.itemDatas = [@[@" 1" , @" 2" , @" 3" , @" 2 " , @" 3 " , @" 2 " , @" 3 " , @" 2 " , @" 3 " , @" 2 " , @" 3 " ] mutableCopy ];
169+ section.itemDatas = [@[@" 0- 1" , @" 0- 2" , @" 0- 3" , @" 0-4 " , @" 0-5 " , @" 0-6 " , @" 0-7 " , @" 0-8 " , @" 0-9 " , @" 0-10 " , @" 0-11 " ] mutableCopy ];
166170 section.cellElement = [FMLayoutElement elementWithViewClass: [FMCollectionCustomCell class ]];
167171 [section setConfigureCellData: ^(FMLayoutBaseSection * _Nonnull section, UICollectionViewCell * _Nonnull cell, NSInteger item) {
168- [(FMCollectionCustomCell *)cell label ].text = [ NSString stringWithFormat: @" %ld " , ( long ) item];
172+ [(FMCollectionCustomCell *)cell label ].text = section. itemDatas [ item];
169173 }];
170174 [section setClickCellBlock: ^(FMLayoutBaseSection * _Nonnull section, NSInteger item) {
171175
@@ -176,7 +180,7 @@ - (void)addSections{
176180 {
177181 FMLayoutAbsoluteSection *section = [FMLayoutAbsoluteSection sectionWithSectionInset: UIEdgeInsetsMake (0 , 0 , 0 , 0 ) itemSpace: 0 lineSpace: 0 column: 0 ];
178182
179- section.itemDatas = [@[@" 1" , @" 2" , @" 3" ] mutableCopy ];
183+ section.itemDatas = [@[@" 1-1 " , @" 1- 2" , @" 1- 3" ] mutableCopy ];
180184 section.cellElements = @[[FMLayoutElement elementWithViewClass: [FMCollectionCustomCell class ]]];
181185 [section setDeqCellReturnReuseId: ^NSString * _Nonnull (FMLayoutDynamicSection * _Nonnull section, NSInteger index) {
182186 return [section.cellElements firstObject ].reuseIdentifier ;
@@ -195,7 +199,7 @@ - (void)addSections{
195199 }
196200 }];
197201 [section setConfigureCellData: ^(FMLayoutBaseSection * _Nonnull section, UICollectionViewCell * _Nonnull cell, NSInteger item) {
198- [(FMCollectionCustomCell *)cell label ].text = [ NSString stringWithFormat: @" %ld " , ( long ) item];
202+ [(FMCollectionCustomCell *)cell label ].text = section. itemDatas [ item];
199203 }];
200204 [section setClickCellBlock: ^(FMLayoutBaseSection * _Nonnull section, NSInteger item) {
201205
0 commit comments