All we needed was a simple UICollectionView with just one cell that contained a label ...

All we needed was a simple UICollectionView with just one cell that contained a label with an unknown amount of text. We just wanted to use the default flow layout and to let auto-layout do the work; we did not want to implement a custom layout. The label was pinned to all sides of the cell’s content view. It did not work. The text inside of the label would get truncated in weird and sometimes random ways.

We ended up using a table view with estimatedRowHeightset to a constant and rowHeight set to UITableView.automaticDimension. The label was still pinned to the content view. It worked like a charm.

Welcome to The infinite monkey theorem

Somewhere a monkey just typed Shakespeare in TypeScript. Be the first to read the masterpieces (and the hilarious misfires) landing on the blog.

Subscribe to The infinite monkey theorem

We fling fresh posts—no banana peels attached—straight to your inbox.