I have a UICollectionView created from a storyboard,
I want to have 3 elements per line in the view. I managed to do this using the following:
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { return CGSizeMake(collectionView.frame.size.width/3.6 , (collectionView.frame.size.height-100)/2); }
However, if I have 6 elements, I got 2 rows of 3 elements each. But when I have 4 elements, it will display 2 rows of 2 elements each.
Is it possible to display them in 2 lines, the first with three elements, and the second contains only 1?
ios objective-c uicollectionview uicollectionviewcell uicollectionviewlayout
Iphone user
source share