如何在 uitableViewCell 中拉伸 collectionView 高度?

how can i stretch collectionView height in tableViewCell?

我想拉伸 tableView 中的 collectionView 高度。

作为gitHub应用程序的标签(下图),
当collectionViewCell的宽度超过collectionView的宽度时,
我想在新行中设置 collectionViewCell

要在新行中设置单元格,我尝试使用 flowlayout。
但它并没有增加高度。只能在 collectionView 中滚动。 .
不幸的是,tableView 的高度没有增加

最好的方法是什么?

SRP-Achiever 中的这种方法应该有效。

override func systemLayoutSizeFitting(_ targetSize: CGSize, withHorizontalFittingPriority horizontalFittingPriority: UILayoutPriority, verticalFittingPriority: UILayoutPriority) -> CGSize {
        collectionView.layoutIfNeeded()
        collectionView.frame = CGRect(x: 0, y: 0, width: targetSize.width , height: 1)
        return collectionView.collectionViewLayout.collectionViewContentSize
}