feat:fix iOS wont use rowSpace when at first line

This commit is contained in:
pengfei.zhou 2019-11-28 19:08:17 +08:00
parent 6a34f45d44
commit a04dcf2212

View File

@ -96,8 +96,10 @@ - (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSInde
CGFloat width = (self.collectionView.width - self.columnSpace * (self.columnCount - 1)) / self.columnCount; CGFloat width = (self.collectionView.width - self.columnSpace * (self.columnCount - 1)) / self.columnCount;
CGFloat height = [self.delegate doricFlowLayoutItemHeightAtIndexPath:indexPath]; CGFloat height = [self.delegate doricFlowLayoutItemHeightAtIndexPath:indexPath];
CGFloat x = (width + self.columnSpace) * [minYOfColumn integerValue]; CGFloat x = (width + self.columnSpace) * [minYOfColumn integerValue];
CGFloat y = self.rowSpace + [self.columnHeightInfo[minYOfColumn] floatValue]; CGFloat y = [self.columnHeightInfo[minYOfColumn] floatValue];
if (y > 0) {
y += self.rowSpace;
}
self.columnHeightInfo[minYOfColumn] = @(y + height); self.columnHeightInfo[minYOfColumn] = @(y + height);
UICollectionViewLayoutAttributes *attrs = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath]; UICollectionViewLayoutAttributes *attrs = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];