I am making a collection view which is horizontally scrolled. The collection view is in a uitableview cell
My height of collection view is 170
I am making a cell of 75x75
-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section;
return UIEdgeInsetsMake(4, 5, 6, 3);
}
This is my inset what I setting. Padding from top is 4 left is 5 right is 3 and bottom is 6. The collection view has 20 items horizontally scrolled. Now my problem is the vertical spacing of items when two rows are made. I want to keep it to minimum. I used this
- (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
{
return 2.5;
}
It provided a 2.5 padding between various items but still my vertical padding is too much as you can see from the image that vertical space between 2 lines of images is around 10. I just want to decrease that to 2.5. I did some change in return UIEdgeInset but if i increase padding from bottom, then the collection view only makes a single row that i dont want. for example if i use this
-(UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section{
return UIEdgeInsetsMake(4, 5, 7, 3);
}
I get this output
How to overcome this problem. I just want equal and minimum spacing between all my items. which are a square (75x75). Any help will be appreciated. Thanks