From eb8531424fdc7edbdb09068762e2b52382364dd1 Mon Sep 17 00:00:00 2001 From: Nguyen Vinh Date: Thu, 27 Aug 2015 05:00:37 +0400 Subject: [PATCH] Fix content size calculation in landscape --- NVBnbCollectionView/NVBnbCollectionViewLayout.m | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/NVBnbCollectionView/NVBnbCollectionViewLayout.m b/NVBnbCollectionView/NVBnbCollectionViewLayout.m index 57974bc..dcc7445 100644 --- a/NVBnbCollectionView/NVBnbCollectionViewLayout.m +++ b/NVBnbCollectionView/NVBnbCollectionViewLayout.m @@ -196,23 +196,23 @@ - (void)calculateContentSize { _contentSize.height += self.headerSize.height; _contentSize.height += (enableLoadMore) ? self.moreLoaderSize.height : 0; } else { + if (numberOfItemsInLastGroup > 0) { + _contentSize.width += _internalGridCellSize.width + self.gridPadding; + } if (numberOfItemsInLastGroup > 1) { - _contentSize.width += _internalGridCellSize.width + self.gridCellSpacing.width + self.gridPadding; + _contentSize.width += _internalGridCellSize.width + self.gridCellSpacing.width; } if (numberOfItemsInLastGroup > 3) { _contentSize.width += _internalParallaxCellSize.width + self.gridPadding; } if (numberOfItemsInLastGroup > 4) { - _contentSize.width += _internalGridCellSize.width; + _contentSize.width += _internalGridCellSize.width + self.gridPadding; } - if (numberOfItemsInLastGroup > 6) { - _contentSize.width += _internalGridCellSize.width * 2 + self.gridCellSpacing.width; + if (numberOfItemsInLastGroup > 5) { + _contentSize.width += _internalGridCellSize.width * 2 + self.gridCellSpacing.width * 2; } if (numberOfItemsInLastGroup > 7) { - _contentSize.width += _internalGridCellSize.width + self.gridPadding; - } - if (numberOfItemsInLastGroup > 8) { - _contentSize.width += _internalParallaxCellSize.width; + _contentSize.width += _internalGridCellSize.width + self.gridCellSpacing.width; } _contentSize.width += self.headerSize.width; _contentSize.width += (enableLoadMore) ? self.moreLoaderSize.width : 0;