From a04dcf2212c54dac826e016c89f1088cf39fe3af Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Thu, 28 Nov 2019 19:08:17 +0800 Subject: [PATCH] feat:fix iOS wont use rowSpace when at first line --- iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m b/iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m index b6258613..211b89e2 100644 --- a/iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m +++ b/iOS/Pod/Classes/Shader/DoricFlowLayoutNode.m @@ -96,8 +96,10 @@ - (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSInde CGFloat width = (self.collectionView.width - self.columnSpace * (self.columnCount - 1)) / self.columnCount; CGFloat height = [self.delegate doricFlowLayoutItemHeightAtIndexPath:indexPath]; 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); UICollectionViewLayoutAttributes *attrs = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];