Skip to content

Commit

Permalink
Fix content size calculation in portrait
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjaprox committed Aug 27, 2015
1 parent dbe8da3 commit 036de1c
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions NVBnbCollectionView/NVBnbCollectionViewLayout.m
Expand Up @@ -175,23 +175,23 @@ - (void)calculateContentSize {
BOOL enableLoadMore = ((NVBnbCollectionView *) self.collectionView).enableLoadMore;

if (UIInterfaceOrientationIsPortrait(self.currentOrientation)) {
if (numberOfItemsInLastGroup > 0) {
_contentSize.height += _internalGridCellSize.height + self.gridPadding;
}
if (numberOfItemsInLastGroup > 1) {
_contentSize.height += _internalGridCellSize.height + self.gridCellSpacing.height + self.gridPadding;
_contentSize.height += _internalGridCellSize.height + self.gridCellSpacing.height;
}
if (numberOfItemsInLastGroup > 3) {
_contentSize.height += _internalParallaxCellSize.height + self.gridPadding;
}
if (numberOfItemsInLastGroup > 4) {
_contentSize.height += _internalGridCellSize.height;
_contentSize.height += _internalGridCellSize.height + self.gridPadding;
}
if (numberOfItemsInLastGroup > 6) {
_contentSize.height += _internalGridCellSize.height * 2 + self.gridCellSpacing.height;
_contentSize.height += _internalGridCellSize.height * 2 + self.gridCellSpacing.height * 2;
}
if (numberOfItemsInLastGroup > 7) {
_contentSize.height += _internalGridCellSize.height + self.gridPadding;
}
if (numberOfItemsInLastGroup > 8) {
_contentSize.height += _internalParallaxCellSize.height;
_contentSize.height += _internalGridCellSize.height + self.gridCellSpacing.height;
}
_contentSize.height += self.headerSize.height;
_contentSize.height += (enableLoadMore) ? self.moreLoaderSize.height : 0;
Expand Down

0 comments on commit 036de1c

Please sign in to comment.