File tree 2 files changed +6
-6
lines changed
UICollectionViewLeftAlignedLayout
2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -58,12 +58,12 @@ - (void)viewWillDisappear:(BOOL)animated
58
58
59
59
- (NSInteger )numberOfSectionsInCollectionView : (UICollectionView *)collectionView
60
60
{
61
- return 1 ;
61
+ return 2 ;
62
62
}
63
63
64
64
- (NSInteger )collectionView : (UICollectionView *)collectionView numberOfItemsInSection : (NSInteger )section
65
65
{
66
- return 100 ;
66
+ return section == 0 ? 20 : 80 ;
67
67
}
68
68
69
69
- (UICollectionViewCell *)collectionView : (UICollectionView *)collectionView cellForItemAtIndexPath : (NSIndexPath *)indexPath
@@ -86,7 +86,7 @@ - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollection
86
86
87
87
- (CGFloat )collectionView : (UICollectionView *)collectionView layout : (UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex : (NSInteger )section
88
88
{
89
- return 5 ;
89
+ return section == 0 ? 15 : 5 ;
90
90
}
91
91
92
92
- (UIEdgeInsets)collectionView : (UICollectionView *)collectionView layout : (UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex : (NSInteger )section
Original file line number Diff line number Diff line change @@ -85,17 +85,17 @@ - (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSInde
85
85
}
86
86
87
87
CGRect frame = currentItemAttributes.frame ;
88
- frame.origin .x = previousFrameRightPoint + [self evaluatedMinimumInteritemSpacingForItemAtIndex : indexPath.row ];
88
+ frame.origin .x = previousFrameRightPoint + [self evaluatedMinimumInteritemSpacingForSectionAtIndex : indexPath.section ];
89
89
currentItemAttributes.frame = frame;
90
90
return currentItemAttributes;
91
91
}
92
92
93
- - (CGFloat )evaluatedMinimumInteritemSpacingForItemAtIndex : (NSInteger )index
93
+ - (CGFloat )evaluatedMinimumInteritemSpacingForSectionAtIndex : (NSInteger )section
94
94
{
95
95
if ([self .collectionView.delegate respondsToSelector: @selector (collectionView:layout:minimumInteritemSpacingForSectionAtIndex: )]) {
96
96
id <UICollectionViewDelegateLeftAlignedLayout> delegate = (id <UICollectionViewDelegateLeftAlignedLayout>)self.collectionView .delegate ;
97
97
98
- return [delegate collectionView: self .collectionView layout: self minimumInteritemSpacingForSectionAtIndex: index ];
98
+ return [delegate collectionView: self .collectionView layout: self minimumInteritemSpacingForSectionAtIndex: section ];
99
99
} else {
100
100
return self.minimumInteritemSpacing ;
101
101
}
You can’t perform that action at this time.
0 commit comments