Reputation:
I'm trying to change minimumLineSpacing
for some cells depending on what row they are.
Imagine having 10 cells; I want minimumLineSpacing
to be 8 for all of them except for cell number 7.
I tried doing it via delegate:
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
But I just wish that it would pass back a NSIndexPath
instead of a section.
I'd appreciate any input.
Upvotes: 0
Views: 160
Reputation:
One workaround:
If you have it subclassed , you should be able to do this very easy with autolayout and a XIB.
Example: If you have a constraint in the cell to the bottom of the contentView, you can simply set the constraint to an NSLayoutConstraint property and update the constant of the constraint for that specific cell only to give an extra spacing.
To keep the same proportions and height as the rest of the cells, you only add the extra spacing (same as you added to the constant) to the itemSize.height to that specific cell.
If you don't have this subclassed with autolayout or anything. You can do it programatically the same way but with a subView frame CGRect
Upvotes: 2