fix: flow layout load more view not span entirely

This commit is contained in:
王劲鹏 2021-06-11 14:40:13 +08:00 committed by osborn
parent cbaa560dea
commit 188e3b55f6

View File

@ -105,6 +105,7 @@ - (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSInde
} }
if (width == self.collectionView.width) { if (width == self.collectionView.width) {
x = 0;
CGFloat maxY = 0; CGFloat maxY = 0;
for (NSNumber *column in self.columnHeightInfo.allValues) { for (NSNumber *column in self.columnHeightInfo.allValues) {
maxY = MAX(maxY, [column floatValue]); maxY = MAX(maxY, [column floatValue]);
@ -338,7 +339,12 @@ - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collection
DoricFlowLayoutItemNode *node = cell.viewNode; DoricFlowLayoutItemNode *node = cell.viewNode;
node.viewId = model[@"id"]; node.viewId = model[@"id"];
[node blend:props]; [node blend:props];
if (position > 0 && position >= self.itemCount) {
node.view.width = collectionView.width;
} else {
node.view.width = (collectionView.width - (self.columnCount - 1) * self.columnSpace) / self.columnCount; node.view.width = (collectionView.width - (self.columnCount - 1) * self.columnSpace) / self.columnCount;
}
if (position > 0 && position >= self.itemCount && self.onLoadMoreFuncId) { if (position > 0 && position >= self.itemCount && self.onLoadMoreFuncId) {
[self callLoadMore]; [self callLoadMore];
} }