Wojtek Dmyszewicz Wojtek Dmyszewicz - 3 months ago 18x
iOS Question

Collapsed height UILabel (attributed text) in UICollectionViewCell but not in UITableViewCell

Attributed text of a UILabel inside a UICollectionViewCell is collapsed 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);