Reputation: 1075
I have the sketch of the layout as follows :-
Above Image, has fixed layout structure as follows
-> First Row has item no.1 and takes all the width of the collection view.
->Second row has item no. 2 and 3 and shares the width equally.
->third row onwards we have to use the default size.
here item1, item2-item3 and all rest of the items have 3 different designs respectively.
the collectionview has 1 section and the datasource over here simple nsarray.
So my question over here is what should I be using ? Any suggestions will be helpful, I am new to UICollectionView and I am finding it little difficult to understand.
Upvotes: 0
Views: 1444
Reputation: 4403
I think you can just use UICollectionViewFlowLayout with a collection view which has two different Cell Kinds. No subclass necessary. This may get hairy if you expect your layout to change when in landscape mode.
The first cell kind would be for items 1, 2, and 3. You'll go your different layout by implementing the collectionView:sizeForItemAtIndexPath:
method. Just make sure index 0(item 1) is full width, and index 1, 2(item 2,3) are half width.
Then you can implement another cell kind for everything else. These items will be full width as well.
In cellForRowAtIndexPath
you'll need to check the indexPath's item property to see which index you are. If > 2, use the second cell kind.
Upvotes: 1