I'm building something as shown in the image below:
I'll try to explain a bit more what my goal is. I have a UITableView
. One UITableViewCell
(1)
in here will contain a title (left out in this image) and a UICollectionView
(2)
(same width as tableview/screen). This collectionview uses a subclass of UICollectionViewLayout
to make it horizontally scrollable, evenly spacing the items.
Each UICollectionViewCell
(3)
in here contain a title and description, both with dynamic heights. Also, this cell contains a new collectionview (4)
. This new collectionview contains a number of items (5)
. In this most inner collectionview a row can contain a maximum of 5 items.
Currently I have a tableviewcell (1)
with horizontally scrollable collectionview (2)
, putting the items (3)
next to each other. I also have the most inner collectionview (4)
putting the items (5)
in the correct way.
The difficulty I'm facing now is:
- To dynamically size the height of collectionview
(4)
, depending on how many rows for the items are needed, so depending on the number of items. - To dynamically size the height of collectionviewcell
(3)
, depending on the height of the title, description and collectionview(4)
. - If possible, to dynamically size the height of the collectionview
(2)
and the tableviewcell(1)
containing this, as high as the biggest cell(3)
.
I hope someone would have an idea how to do this, if it is even possible. I do hope so, while keeping the code 'easy' to follow.
I can do a lot with constraints / autolayout, but this I can't get my head around.