Flowlayout's loadMoreView supports fullSpan,default is false

This commit is contained in:
pengfei.zhou
2021-10-11 18:32:14 +08:00
committed by osborn
parent 738c072ee4
commit f09f7859b9
7 changed files with 20 additions and 23 deletions

View File

@@ -365,9 +365,12 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
DoricFlowLayoutItemNode *node = cell.viewNode;
node.viewId = model[@"id"];
[node blend:props];
BOOL fillWidth = [props[@"fullSpan"] boolValue]
|| (self.loadMore && position >= self.itemCount);
if (fillWidth) {
BOOL fullSpan = self.loadMore && position >= self.itemCount;
if (props[@"fullSpan"]) {
fullSpan = [props[@"fullSpan"] boolValue];
}
if (fullSpan) {
node.view.width = collectionView.width;
} else {
node.view.width = (collectionView.width - (self.columnCount - 1) * self.columnSpace) / self.columnCount;
@@ -413,12 +416,12 @@ - (NSInteger)doricFlowLayoutColumnCount {
- (BOOL)doricFlowLayoutItemFullSpan:(NSIndexPath *)indexPath {
NSUInteger position = (NSUInteger) indexPath.row;
if (self.loadMore && position >= self.itemCount) {
return YES;
} else {
NSDictionary *model = [self itemModelAt:position];
return [model[@"props"][@"fullSpan"] boolValue];
BOOL fullSpan = self.loadMore && position >= self.itemCount;
NSDictionary *model = [self itemModelAt:position];
if (model[@"props"][@"fullSpan"]) {
fullSpan = [model[@"props"][@"fullSpan"] boolValue];
}
return fullSpan;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {