diff --git a/UICollectionViewLeftAlignedLayout/UICollectionViewLeftAlignedLayout.m b/UICollectionViewLeftAlignedLayout/UICollectionViewLeftAlignedLayout.m index c4bf2b6..c083b88 100644 --- a/UICollectionViewLeftAlignedLayout/UICollectionViewLeftAlignedLayout.m +++ b/UICollectionViewLeftAlignedLayout/UICollectionViewLeftAlignedLayout.m @@ -57,7 +57,14 @@ - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect { } - (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath { - UICollectionViewLayoutAttributes* currentItemAttributes = [[super layoutAttributesForItemAtIndexPath:indexPath] copy]; + UICollectionViewLayoutAttributes* currentItemAttributes; + + if (@available(iOS 10, *)) { + currentItemAttributes = [[super layoutAttributesForItemAtIndexPath:indexPath] copy]; + } else { + currentItemAttributes = [super layoutAttributesForItemAtIndexPath:indexPath]; + } + UIEdgeInsets sectionInset = [self evaluatedSectionInsetForItemAtIndex:indexPath.section]; BOOL isFirstItemInSection = indexPath.item == 0;