Created
October 12, 2021 00:09
-
-
Save theoknock/ebc6105604c1732375de2e37e04245ad to your computer and use it in GitHub Desktop.
Performing a selector on objects in a copy of an autoreleasing array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributesForElementsInRect:(CGRect)rect { | |
__autoreleasing NSArray<UICollectionViewLayoutAttributes *> * collectionViewLayoutAttributes; | |
[self performSelector:@selector(changeLayoutAttributes:) withObject:[collectionViewLayoutAttributes = [[NSArray alloc] initWithArray:[super layoutAttributesForElementsInRect:rect] copyItems:TRUE] self]]; | |
return (NSArray<UICollectionViewLayoutAttributes *> *)collectionViewLayoutAttributes; | |
} | |
- (void)changeLayoutAttributes:(NSArray<UICollectionViewLayoutAttributes *> *)layoutAttributes { | |
for (UICollectionViewLayoutAttributes * attribute in layoutAttributes) { | |
// change attribute code | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment