简体   繁体   中英

In swift how to set CollectionView height according to its content while it is in the tableview cell?

Hi I am creating an app where I need to show day and time, in which day are showing first in the table view cell and when click on table view cell the cell will expand and show the collection view, in this collection view I have list of time of that particular date. So my question is how to show these array of time in collection view so that I do not need to scroll, the height of collection view will increase according to its content.

Why don't you use the UICollectionViewCompositionalLayout. It'll allow you to build very flexible width and height cells. It has a func called.estimated(estimatedDimension:) which will calculate it's point greater than or equal to the value you passed in.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM