From b2523b62eef9f9471e954f106901e8d25577944c Mon Sep 17 00:00:00 2001 From: Bojke Date: Thu, 29 Sep 2022 13:13:51 +0200 Subject: [PATCH] (fix) ObjC: unified cell height logic with swift --- Source/CHTCollectionViewWaterfallLayout.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/CHTCollectionViewWaterfallLayout.m b/Source/CHTCollectionViewWaterfallLayout.m index 1a5bd12..f5633e7 100644 --- a/Source/CHTCollectionViewWaterfallLayout.m +++ b/Source/CHTCollectionViewWaterfallLayout.m @@ -314,8 +314,11 @@ - (void)prepareLayout { CGFloat yOffset = [self.columnHeights[section][columnIndex] floatValue]; CGSize itemSize = [self.delegate collectionView:self.collectionView layout:self sizeForItemAtIndexPath:indexPath]; CGFloat itemHeight = 0; - if (itemSize.height > 0 && itemSize.width > 0) { - itemHeight = CHTFloorCGFloat(itemSize.height * itemWidth / itemSize.width); + if (itemSize.height > 0){ + itemHeight=itemSize.height; + if(itemSize.width > 0) { + itemHeight = CHTFloorCGFloat(itemSize.height * itemWidth / itemSize.width); + } } attributes = [UICollectionViewLayoutAttributes layoutAttributesForCellWithIndexPath:indexPath];