Reputation: 27191
I have implemeted this method
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{
return UIEdgeInsetsMake(0, 0, 0, 0);
}
So the method invokes in any case because if I change for example with UIEdgeInsetsMake(0, 0, 100, 0)
I can see 100 pt padding on the top of each section. But if I set zero value there is still approximately 10 pt between lines.
Upvotes: 0
Views: 158
Reputation: 53142
Set that in your flow layout
UICollectionViewFlowLayout * flow = [[UICollectionViewFlowLayout alloc]init];
flow.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
flow.scrollDirection = UICollectionViewScrollDirectionVertical;
flow.minimumInterItemSpacing = 0; // space between cells in row
flow.minimumLineSpacing = 0; // space between rows
yourCollectionView = [[UICollectionView alloc]initWithFrame:someFrame collectionViewLayout:flow];
Or Delegate Method:
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
return 0;
// space between cells on different lines
}
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {
return 0;
// space beetween cells in same row
}
Upvotes: 1