Spacing between cells in CollectionView

I am using a collection view with custom cells in my xib. All cells are 45 x 45. The image that fills the view is also 45 x 45 per cell. All spacing and insertions are set to 0 in my xib and also with the code below. My question is, why is there still a small space between the cells? Thank!

- (UIEdgeInsets)collectionView:(UICollectionView*)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
    return UIEdgeInsetsMake(0, 0, 0, 0); // top, left, bottom, right
}

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section {

    return 0.0;
}

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section {
    return 0.0;
}

      

enter image description here

+3


source to share


1 answer


You can set a minimum spacing, but not the actual spacing between cells. Thus, if the collection view is not a multiple of 45, then there will be spaces added by the system.



+3


source







All Articles