现在,这是一个 UITableView,假设它是一个 UITableViewCell。
我在想做什么:-
1. Lets create a UICollectionView inside the UITableViewCell, this will have
3 rows. Every row will contain another UICollectionView where I will put
the data
FLow will be like this :-
UITableView -> UITableViewCell -> UICollectionView -> UICollectionViewCell -> UICollectionView -> UICollectionViewCell
2. create a UICollectionView inside the UITableViewCell, this will have
3 rows. Now I will create a view which contains data as whole and put it on cell. Height will be calculated programatically and view is put inside UICollectionViewCell
所以其他解决方案也是如此,但我对我想到的解决方案不满意。
如果有人知道执行此操作的正确解决方案。让我知道。我更喜欢以更好的方式做事。
如果您需要更多详细信息,请告诉我
最佳答案
创建一个UICollectionView
将 UICollectionViewCell
添加到 Storyboard中的 View
将 Vertical UIStackView
添加到具有属性 Fill 和 Equal Spacing
的单元格。
将布局约束添加到单元格的 top,left,right,bottom
。
现在在 cellForRowAtIndexPath
函数中,您可以将尽可能多的 addArrangedSubviews
添加到 UIStackView
。
要自定义 Cell
的大小覆盖函数 sizeForItemAtIndexPath
关于ios - 创建一个 View ,如 iOS 的图片所示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51606600/