I can create a multi-line NSAttributedString
by using escaped new-line characters (@\"\\n\"
). With iOS 7, I can now embed a UIImage
in
I have found another workaround for this bug, which is sufficiently different from my previous answer that I'm providing it as another answer: let the label set its own height.
In this code, I'm removing the height constraint from a label with a fixed width constraint, and replacing it with a greater-than height constraint (and I'm sure there are other ways to achieve the same outcome):
[self.lab removeConstraint:self.labelHeight];
[self.lab addConstraint:
[NSLayoutConstraint constraintWithItem:self.lab
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationGreaterThanOrEqual
toItem:nil attribute:0 multiplier:1 constant:20]];
That label displays correctly every attributed string I throw at it! Of course, you lose the automatic vertical centering of the string, but that's the whole source of the bug, so losing it is not so terrible.