From b931e9754905e602a19309820b4a03785fb2192f Mon Sep 17 00:00:00 2001 From: Andrey Medvedev Date: Wed, 9 Sep 2020 23:17:11 +0700 Subject: [PATCH] consider the insetForSection for estimating size --- IVCollectionKit/Source/CollectionSection.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/IVCollectionKit/Source/CollectionSection.swift b/IVCollectionKit/Source/CollectionSection.swift index c77c9d0..77ca9fc 100644 --- a/IVCollectionKit/Source/CollectionSection.swift +++ b/IVCollectionKit/Source/CollectionSection.swift @@ -81,7 +81,9 @@ open class CollectionSection : AbstractCollectionSection { } open func sizeForItem(at indexPath: IndexPath, boundingSize: CGSize) -> CGSize { - return items[indexPath.item].estimatedSize(boundingSize: boundingSize) + let sizeWithInsets = CGSize(width: boundingSize.width - insetForSection.left - insetForSection.right, + height: boundingSize.height - insetForSection.top - insetForSection.bottom) + return items[indexPath.item].estimatedSize(boundingSize: sizeWithInsets) } open func itemAdjustsWidth(at index: Int) -> Bool {