iOS: fix flowlayout loadmoreView do not show on content

This commit is contained in:
pengfei.zhou 2021-07-15 18:07:59 +08:00 committed by osborn
parent 9531fbffc0
commit c82510f57a

View File

@ -111,11 +111,15 @@ - (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSInde
if (width == self.collectionView.width) { if (width == self.collectionView.width) {
x = 0; x = 0;
CGFloat maxY = 0; NSNumber *maxYColumn = @(0);
for (NSNumber *column in self.columnHeightInfo.allValues) { for (NSNumber *key in sortedKeys) {
maxY = MAX(maxY, [column floatValue]); if ([self.columnHeightInfo[key] floatValue] > [self.columnHeightInfo[maxYColumn] floatValue]) {
maxYColumn = key;
}
} }
CGFloat maxY = [self.columnHeightInfo[maxYColumn] floatValue];
y = maxY + self.rowSpace; y = maxY + self.rowSpace;
self.columnHeightInfo[maxYColumn] = @(y + height);
} else { } else {
self.columnHeightInfo[minYOfColumn] = @(y + height); self.columnHeightInfo[minYOfColumn] = @(y + height);
} }