Remove space between sections in collectionview

Bhanu Birani picture Bhanu Birani · Feb 7, 2015 · Viewed 12.9k times · Source

How to adjust the spacing between sections of collection view.

enter image description here

Answer

Mayank Birani picture Mayank Birani · Jun 16, 2015

You can use the method to implement this:

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

    if ([[sectionHeaderStatusArray objectAtIndex:section] boolValue]) {
        return UIEdgeInsetsMake(23, 19, 46, 14);
    }

      return UIEdgeInsetsZero;
}