I have this code
-(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row==0)
{
return CGSizeMake(320, 143.5);
}
else if (indexPath.row==1)
{
return CGSizeMake(320, 143.5);
}
else
{
return CGSizeMake(160, 160); //This line
}
}
I intend to have a two columns in line without gap, but returning 160 size will cause the cell have two rows with one cell each. so for the time being I set it to (155,155) but it leaves gap between the cell.
so how to remove that gap?
Update
solved after using @AlwaysWannaLearn solution!
but don't forget to set the inset.
- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
return UIEdgeInsetsMake(0,0, 0, 0); // top, left, bottom, right
}