Collection-View-in-a-Table-View-Cell icon indicating copy to clipboard operation
Collection-View-in-a-Table-View-Cell copied to clipboard

Table section headers

Open rmatte01 opened this issue 8 years ago • 1 comments

Thanks. This is awesome.

Can you please help me figure out what is the best way to set the section headers in this case?

One way I am thinking is to set the multiple sections with each section having only one row. Or there any other best ways?

rmatte01 avatar Apr 20 '16 13:04 rmatte01

Each section having only one row is possible – depends on your design. To have multiple rows is more work, though. Consider that we have have basically two levels of indexing right now: table view row -> collection view item. To have multiple sections with single rows, it's as simple as replacing one of those levels: table view section -> collection view item. Introducing multiple rows in multiple sections will require another level of indirection, instead of just changing an existing level: table view section -> table view row -> collection view item. This means instead of having a [[UIColor]] array of arrays, we would need [[[UIColor]]], which is more complicated. Alternatively, we could use a dictionary of [NSIndexPath: [UIColor]], where the index path is the index path of the table view cell, and the array at each index path is the array for that cell's collection view.

Don't worry if this sounds intimidating – everyone has a hard time with this at first. I'd encourage you to experiment and see what works for you, and I'm sure you'll figure it out!

ashfurrow avatar Apr 21 '16 10:04 ashfurrow