I have set up multiple horizontally-scrolling UICollectionView
(s), within a UITableView
, so I can scroll vertically.
One issue I ran into is that, the row's height for the table view, is called before I know how tall they should be (I want the whole height of each UICollectionView
to fill the table view cell).
How do I go about solving this?
You need to reduce the height of UICollectionView to its cell / item height and select " Horizontal " from the " Scroll Direction " as seen in the screenshot below. Then it will scroll horizontally depending on the numberOfItems you have returned in its datasource implementation.
Remember, before you make a decision consider if it is just a straight-up list of things with no designs or anything like that, use a TableView. Then if you want more customizability with each cells, like a frame for a portrait, use a CollectionView.
When would you choose to use a collection view rather than a table view? Suggested approach: Collection views are there to display grids, but also handle entirely custom layouts, whereas table views are simple linear lists with headers and footers.
Implementation of adding a table view inside the cell of UItableview aka, Nested Table View. Used the Power of Autosizing table view and delegate to achieve the expansion and collapse of the cell height.
My suggestion would be to create a custom layout for the collection view. Then it could compute the cell size and be notified when the collection view is resized.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With