Wojtek Dmyszewicz Wojtek Dmyszewicz - 1 year ago 149
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.

Answer Source

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

self.yourUIlabel.preferredMaxLayoutWidth = CGRectGetWidth(self.bounds);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download