File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
packages/collectionview/platforms/ios/src Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -18,19 +18,21 @@ - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollection
1818- (CGSize)collectionView : (UICollectionView *)collectionView layout : (UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath : (NSIndexPath *)indexPath
1919{
2020 NSInteger index = indexPath.row ;
21- if (index < [self .cachedSizes count ]) {
22- NSValue * value = [self .cachedSizes objectAtIndex: indexPath.row];
21+ NSInteger count = [self .cachedSizes count ];
22+ if (index < count) {
23+ NSValue * value = [self .cachedSizes objectAtIndex: index];
2324 if (value != nil && !CGSizeEqualToSize ([value CGSizeValue ], CGSizeZero)) {
2425 return [value CGSizeValue ];
2526 }
26- CGSize size = [self collectionView: collectionView layout: collectionViewLayout computedSizeForItemAtIndexPath: indexPath];
27+ }
28+ CGSize size = [self collectionView: collectionView layout: collectionViewLayout computedSizeForItemAtIndexPath: indexPath];
29+ count = [self .cachedSizes count ];
30+ if (index < count) {
2731 [self .cachedSizes replaceObjectAtIndex: indexPath.row withObject: [NSValue valueWithCGSize: size]];
28- return size;
2932 } else {
30- CGSize size = [self collectionView: collectionView layout: collectionViewLayout computedSizeForItemAtIndexPath: indexPath];
3133 [self .cachedSizes addObject: [NSValue valueWithCGSize: size]];
32- return size;
3334 }
35+ return size;
3436}
3537
3638@end
You can’t perform that action at this time.
0 commit comments