UICollectionView- How to remove the spacing above the first cell?
I have top insert = 0 and rows = 10

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{ if (indexPath.row == 0) { return CGSizeMake(collectionView.width, 44); } return CGSizeMake(300, 150); } - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section { return UIEdgeInsetsMake(0, 10, 10, 10); }
This seems to be due to setting the first cell to a different size
if I remove the check for row == 0 in sizeForItemAtIndexPath and return it for all cells, it is at the same level as the top one.
Any ideas?
source share