You have two options to achieve this functionality.
1) Use a tableview and use autolayout so that cell height increases automatically according to the content.
2) Use collection view and calculate the height of the textview in this method and specify the cell size in this method sizeforitematindexpath.
Once the textis set to the textview then change the textview frame to
textview.frame = CGRect(x: textview.frame.orgin.x, y:textview.frame.orgin.y, width: textview.frame.width, height = textview.contentSize.height)
Now calculate the textview height in cellForItemAtIndexPath method and add that height to the cell height.
Hi this is the solution for collectionViewCell AutoAdjust cell height Size. Check below link it should works fine.
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.