Pramod Tapaniya
Pramod Tapaniya

Reputation: 1266

Collectionview Maximum space between cell

In my application i use UICollectionView for listing of product. Requirement is to set height of cell conditionally. I use following code for it.

- (CGSize)collectionView:(UICollectionView *)collectionView
                  layout:(UICollectionViewLayout*)collectionViewLayout
  sizeForItemAtIndexPath:(NSIndexPath *)indexPath;
{
        if (indexPath.row == 3 || indexPath.row == 6 || indexPath.row == 7 || indexPath.row == 10 || indexPath.row == 0)
        {
            return CGSizeMake((collectionView.frame.size.width/2)-4, 300.0);
        }

        return CGSizeMake((collectionView.frame.size.width/2)-4, 250.0);
}

by, this code completely set height of cell but horizontal cell not set properly like image. i want remove extra space between vertical cell. I set min spacing for cell and line are 8pixel from storyboard's edges.

Thank you in advance.enter image description here

Upvotes: 2

Views: 896

Answers (1)

Pramod Tapaniya
Pramod Tapaniya

Reputation: 1266

Finally i solve the problem by wonderful library Link and very easy to implement.

Upvotes: 1

Related Questions