Sarabyte Studios Sarabyte Studios - 1 year ago 109
Objective-C Question

UICollectionView distance between cells?

I'm using a UICollectionView with cell width equal 67, right now i am using the flow layout.

I have 3 cells in a row with space between cells equal 30. How can make that distance less

so i can fit four cells in a row? Does this method have something to do with it?

- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
return UIEdgeInsetsMake(10, 10, 10, 10);


This UICollectionViewFlowLayoutDelegate method will help you..

- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionView *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section  
    return 10; // This is the minimum inter item spacing, can be more

One more if you need more space to arrange your cells adjust the edgeInsets also