I would like to make UICollectionView as the following image.
However, I got the following.
I am using UICollectionView flow layout. I used the following code to defined each cell size.
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
// return CGSizeMake(kScreenWidth*1.0/2 - 10, kScreenHeight*1.0/3.0 - 10);
if (indexPath.row == 0) {
return CGSizeMake(kScreenWidth*2.0/3 - 20, kScreenHeight*2.0/3.0 - 10);
} else if (indexPath.row == 1 || indexPath.row == 2 || indexPath.row == 3 || indexPath.row == 4 ||indexPath.row == 5) {
return CGSizeMake(kScreenWidth*1.0/3 - 30, kScreenHeight*1.0/3.0 - 10);
} else {
return CGSizeMake(kScreenWidth*1.0/2 - 10, kScreenHeight*1.0/3.0 - 10);
}
}
I expected the cell 2 will be aligned well to cell 1. However, it flowed to the next column. How can I make the layout as the first image?
Thanks.