-2

I want to create a custom layout which should look like the picture here: Custom Layout

I found a tutorial by Ray Wenderlich (https://www.raywenderlich.com/107439/uicollectionview-custom-layout-tutorial-pinterest) which does more or less the same but it was to complicated for me so I wasn't able to shift this to my needs.

I just need the easy layout, and I also know the size for my cells, I don't have to calculate them. Could anyone please help me.

Philipp Rosengart
  • 713
  • 1
  • 8
  • 20
  • This layout is Flow Layout so use delegate method - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath { return CGSizeMake(50, 50); } and pass size based on indexPath. – kaushal Jul 10 '16 at 16:21

1 Answers1

0

In

func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {

of UICollectionViewDataSource create a switch for the variable indexPath.row and set the size of the cell:

cell.frame = CGMake(height: myHeight; width: myWidth)
alessionossa
  • 923
  • 2
  • 15
  • 41