I hope it is ok to ask this here. Otherwise, please feel free to delete this issue.
I'm playing with the examples and am wondering what's the best way to create a collection view with sections that scroll in different directions. So for example let's say there are two sections, the first has items that scroll horizontally, but it also scrolls vertically along with the second section.
So far I've been achieving this by putting a collection view in a table view cell.
Along these lines, let's say in addition to that, that we want the first 'horizontal' section to be fixed, meaning that it won't scroll along with the second section. Should we just use two different collection views for those sections in this case?
Hey @bonzoq ! Definitely ok ๐ ๐
So far I've been achieving this by putting a collection view in a table view cell.
This is how we currently handle this for our own uses. (Except we put a collection view inside collection view cells โ since ListKit is only for collection views.)
We want to provide this functionality "out-of-the-box", but currently don't have a solution. We're tracking this at #31. Let's move this conversation there. ๐
Along these lines, let's say in addition to that, that we want the first 'horizontal' section to be fixed, meaning that it won't scroll along with the second section. Should we just use two different collection views for those sections in this case?
This would definitely be out-of-scope for #31, but we could address this once #31 is finished.
Thank you for answering this so quickly @jessesquires ๐ โค๏ธ
@bonzoq Did you figure this out?
Hey @otymartin, here's a rather general description of how I handle this:
class DataForHorizontalCollectionView: IGListDiffable {
var dataForIndividualCells: [String]?
func diffIdentifier() -> NSObjectProtocol {
// implement this
}
func isEqual(_ object: IGListDiffable?) -> Bool {
//implement this based on the data stored in 'dataForIndividualCells'
}
}
cellForItem(at index: Int) -> UICollectionViewCell method of your section controller created in point 2, pass data to your second collection view. Hope this helps.
@bonzoq Thanks for sharing your solution. Im following along and will reach back when I manage to implement something. Might have some follow up Q's though. (Sticky headers)
@otymartin sure thing, let me know if you've any questions whatsoever.
@bonzoq I tried to implement this solution but my horizontal collection view is not receiving any touch event and i'm not able to scroll it. Did I missed something?
@jr9098 Did you use my method of embedding the collectionview in a tableview cell?
@otymartin I'm using @bonzoq 5 steps solution
@jr9098 I documented my solution in #304 incase. I never managed to implement this method but can't believe it would be that hard, the example projects do it.
@otymartin thanks for your help, I managed to do it with the example (HorizontalSectionController and EmbeddedSectionController in the example project)!
Most helpful comment
Hey @otymartin, here's a rather general description of how I handle this:
that has another instance IGListCollectionView in it, this collection view ought to have a horizontal flow layout. In the
cellForItem(at index: Int) -> UICollectionViewCellmethod of your section controller created in point 2, pass data to your second collection view.Hope this helps.