Iglistkit: Multiple rows with horizontal scroll

Created on 26 Sep 2017  路  6Comments  路  Source: Instagram/IGListKit

I was't able to find an answer to this, but apologies if this has been answered before or I have misunderstood the documentation.

After experimenting with the example projects, I tried to make the Nested Adapter support having 2 rows in the horizontally scrollable section, instead of 1.

With a default UICollectionView with horizontal scroll and cellHeight < (collectionViewHeight - insets) / numberOfRows) I would expect a the cells to grow like the second section in this image:

simulator screen shot - iphone 8 plus - 2017-09-26 at 11 56 14

But when decreasing the cellSize in the ExampleProject, they stay locked in at 1 row:

test

This might be the behaviour you want, and if this is intended than how can I make it break into multiple rows?

Keep up the good work 馃憤 馃帀

question

Most helpful comment

Hi @ChristianLysne, as far as I can tell, the screenshot you show of the Nested Adapter uses UICollectionViewFlowLayout for its EmbeddedCollectionViewCells, so you wouldn't get the benefit of the horizontal support that we just added to IGListCollectionViewLayout that @rnystrom mentions.

But IGListCollectionViewLayout should do want you want with little or no customization -- I have an example in my fork of IGListKit if you want to clone and checkout the try-new-demo branch. Run the example app and go to Nested Horizontal Flow. It looks like the screenshot below, and I believe it stacks in the way you intend (stacks vertically until it runs out of room and needs to start a new row).

This class is where the horizontally-scrolling layout is used.

(I had thought about adding my example to the Demo, but didn't know how much interest there'd be...)

Hope this helps!

horizontal-scrolling

All 6 comments

If I understood you correctly you need to use / create a collection view layout that supports this :) The one in the example will not.

This is a nice one : https://github.com/rhodgkins/RDHCollectionViewGridLayout

image

Thanks @heumn 馃槃 Was hoping to not use a custom flow layout when the default works without IGListKit, but this works as a backup solution 馃憤

@ChristianLysne we just added horizontal support to IGListCollectionViewLayout, but tbh I don't recall the stacking-fit behavior. It _might_ work like this (cc @edmonston for details).

Hi @ChristianLysne, as far as I can tell, the screenshot you show of the Nested Adapter uses UICollectionViewFlowLayout for its EmbeddedCollectionViewCells, so you wouldn't get the benefit of the horizontal support that we just added to IGListCollectionViewLayout that @rnystrom mentions.

But IGListCollectionViewLayout should do want you want with little or no customization -- I have an example in my fork of IGListKit if you want to clone and checkout the try-new-demo branch. Run the example app and go to Nested Horizontal Flow. It looks like the screenshot below, and I believe it stacks in the way you intend (stacks vertically until it runs out of room and needs to start a new row).

This class is where the horizontally-scrolling layout is used.

(I had thought about adding my example to the Demo, but didn't know how much interest there'd be...)

Hope this helps!

horizontal-scrolling

Thanks! Worked great and is exactly what I wanted 鉂わ笍

@ChristianLysne Please how did you solve this I want to do something that looks like this:
img_9e5c9691aa8f-1
The items are stacked till they fill up the height of the cell and then wrap to the next cell

Was this page helpful?
0 / 5 - 0 ratings

Related issues

HarshilShah picture HarshilShah  路  3Comments

rnystrom picture rnystrom  路  3Comments

rnystrom picture rnystrom  路  3Comments

lucabartoletti picture lucabartoletti  路  3Comments

shuhrat10 picture shuhrat10  路  3Comments