Reputation: 95
I need to create a UIcollectionview with grids of cells with 3 cells per row. After a certain amount of cells, lets say 60, I need to display a big cell with image view inside of it, and the cells needs to be in full width of the UIcollectionview. I have done created the 3 cells part, but I failed to figure out how to insert the big image cell and how to layout it properly. Thanks.
Upvotes: 1
Views: 212
Reputation: 423
You could specify the size of the cell in the UICollectionViewFlowLayout delegate method
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
//logic to find if the cell is 60 th item and then and dont forget to return the size of the other cells.
if 60th cell {
return size
} else {
return size
}
}
Upvotes: 0
Reputation: 371
How about you do a few sections? And the header is the other cell. You can put an image there as well.
Upvotes: 1