Mayank Modi Mayank Modi - 5 months ago 11
iOS Question

How to achieve this type of collection view grid

Removed due to internal issue.

Answer

Have you try this. Change your sizeForItemAtIndexPath function with my one.

- (CGSize)collectionView:(UICollectionView *)collectionView
          layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row%3==0) {
        return CGSizeMake(self.collectionView.frame.size.width, 80);
    }
    CGFloat minSpace = 10; //Set this minSpace for space that you want between two cell
    return CGSizeMake((self.collectionView.frame.size.width - minSpace)/2, 80);
}

Also change your cellForItemAtIndexPath if condition with this if condition to return two different cell. If you have.

Hope this will help you.

Comments