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];