UICollectionView
is similar to waterfall flow, and the contentSize
of UICollectionView
is determined according to the size of the text. I hope that the height of UITableViewCell
can change according to the height of UICollectionView
. How can I do it?
If you want to automatically calculate the tableview cell height, it is difficult to do it.
You can first calculate the overall height of the collectionView, and then update the tableview cell height.
For smoothness, the height can be cached.
UICollectionView
的高度、UITableViewCell
height?Is it possible that the question was asked wrongly, and I didn’t understand the scene selection expressed by the poster?
Write a cgfloat attribute in the tableview to record the height of the collectionview, and assign the value in the heightForRow method in the controller. It should be fine