Define auto height in UICollectionViewCell


Is there any way that the height of a UICollectionViewCell suits the content as in UITableViewCell ??

Example: In the UITableViewCell I have this code so that the height adapts to the content:

self.tableView.rowHeight = UITableViewAutomaticDimension
self.tableView.estimatedRowHeight = 250.0

How can I make the cells in UICollectionViewCell work the same?

Thank you!

asked by 07.07.2016 в 11:21

1 answer


In cells of type UICollectionViewCell works exactly the same as UITableViewCell . The most important thing is that the constraints of Autolayout are correctly configured.

On the other hand, keep in mind that it usually works only with text controls.

answered by 18.07.2016 / 10:22