From 9808b047e63ad5b2f1f2c2286e2d75459a98cee2 Mon Sep 17 00:00:00 2001 From: Robert Carlsen Date: Wed, 6 Nov 2013 17:25:59 -0500 Subject: [PATCH] fixing off-by-one error for bottom alignment --- NHAlignmentFlowLayout/NHAlignmentFlowLayout.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NHAlignmentFlowLayout/NHAlignmentFlowLayout.m b/NHAlignmentFlowLayout/NHAlignmentFlowLayout.m index 62ca981..515d1de 100644 --- a/NHAlignmentFlowLayout/NHAlignmentFlowLayout.m +++ b/NHAlignmentFlowLayout/NHAlignmentFlowLayout.m @@ -144,7 +144,7 @@ -(UICollectionViewLayoutAttributes *)layoutAttributesForBottomAlignmentForItemAt return attributes; } - if (indexPath.item == [self.collectionView numberOfItemsInSection:indexPath.section]) { + if (indexPath.item == [self.collectionView numberOfItemsInSection:indexPath.section] - 1) { frame.origin.y = self.collectionViewContentSize.height - self.sectionInset.bottom - frame.size.height; } else { NSIndexPath *nextIndexPath = [NSIndexPath indexPathForItem:indexPath.item + 1 inSection:indexPath.section];