I'm trying to get self sizing
UICollectionViewCells working with Auto Layout, but I can't seem to get the cells to size themselves to the content. I'm having trouble understanding how the cell's size is updated from the contents of what's inside the cell's contentView.
Here's the setup I've tried:
UITextViewin its contentView.
- Scrolling for the
- The contentView's horizontal constraint is: "H:|[_textView(320)]", i.e. the
UITextViewis pinned to the left of the cell with an explicit width of 320.
- The contentView's vertical constraint is: "V:|-0-[_textView]", i.e. the
UITextViewpinned to the top of the cell.
UITextViewhas a height constraint set to a constant which the
UITextViewreports will fit the text.
Here's what it looks like with the cell background set to red, and the
UITextView background set to Blue:
I put the project that I've been playing with on GitHub here.