Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Table view cell size for horizontal UICollectionView within a UITableView

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?

like image 494
Boon Avatar asked May 06 '16 11:05

Boon


People also ask

How do I make my UICollectionView scroll horizontal?

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.

Should I use TableView or CollectionView?

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.

What is difference between TableView and 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.

Is it possible to add UItableview within a Uitableviewcell?

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.


1 Answers

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.

like image 122
Holly Avatar answered Oct 25 '22 10:10

Holly