I have a label that I want to set to text with a custom line height. I also want to use dynamic type.
Here's how I'm setting the label:
let attributedString = NSMutableAttributedString(string: "A long string with lots of lines")
attributedString.addAttribute(NSParagraphStyleAttributeName,
value: NSMutableParagraphStyle(minimumLineHeight: 28),
range: NSRange(location: 0, length: attributedString.length))
myLabel.attributedText = attributedString
If I use the accessibility inspector it won't resize unless I add this line below it:
myLabel.font = UIFont.preferredFont(forTextStyle: .body)
In storyboard the label is set up to use a text-style, be zero lines, word wrap, etc etc... This only happens when using attributed strings.
Is this an apple bug?