Wojtek Dmyszewicz Wojtek Dmyszewicz - 7 months ago 82
iOS Question

Attributed text UILabel cut off in UICollectionViewCell but not in UITableViewCell

Attributed text UILabel inside a UICollectionViewCell is cut off after scrolling (autolayout turned on).

Why does the same setup in a UITableViewCell is working fine. (the constraints / priority levels are identical as well)

Using a custom font.


Resolved it by providing the cell width for the UILabel property preferredMaxLayoutWidth.

self.yourUIlabel.preferredMaxLayoutWidth = CGRectGetWidth(self.bounds);

Found the answer here: http://johnszumski.com/blog/auto-layout-for-table-view-cells-with-dynamic-heights