File tree 1 file changed +8
-8
lines changed
UICollectionViewLeftAlignedLayout
1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -44,16 +44,16 @@ @implementation UICollectionViewLeftAlignedLayout
44
44
#pragma mark - UICollectionViewLayout
45
45
46
46
- (NSArray *)layoutAttributesForElementsInRect : (CGRect )rect {
47
- NSMutableArray * attributesToReturn = [NSMutableArray array ];
48
- for (UICollectionViewLayoutAttributes* attributes in [ super layoutAttributesForElementsInRect: rect]) {
49
- UICollectionViewLayoutAttributes* attributesCopy = [attributes copy ];
50
- if (nil == attributesCopy .representedElementKind ) {
51
- NSIndexPath * indexPath = attributesCopy. indexPath ;
52
- attributesCopy. frame = [self layoutAttributesForItemAtIndexPath: indexPath]. frame ;
47
+ NSArray *originalAttributes = [super layoutAttributesForElementsInRect: rect ];
48
+ NSMutableArray *updatedAttributes = [ NSMutableArray arrayWithArray: originalAttributes];
49
+ for ( UICollectionViewLayoutAttributes *attributes in originalAttributes) {
50
+ if (!attributes .representedElementKind ) {
51
+ NSUInteger index = [updatedAttributes indexOfObject: attributes] ;
52
+ updatedAttributes[ index ] = [self layoutAttributesForItemAtIndexPath: attributes. indexPath];
53
53
}
54
- [attributesToReturn addObject: attributesCopy];
55
54
}
56
- return attributesToReturn;
55
+
56
+ return updatedAttributes;
57
57
}
58
58
59
59
- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath : (NSIndexPath *)indexPath {
You can’t perform that action at this time.
0 commit comments