I'm trying to support Large Font Accessibility in the app. There are places where we are using NSAttributedString to set the attributedText of a UILabel.
On UILabel, we've set adjustsFontForContentSizeCategory = true. Also, in the attributes, we're using UIFontMetrics to allow the label to adapt to the size changes.
UIFontMetrics(forTextStyle: .caption2).scaledFont(for: UIFont.systemFont(ofSize: 11))
Issue:
When I run the app, the UILabel displays the attributedText as per the device's current Size Category. But, when I change the size category from device's accessibility settings, the UILabel is not updated accordingly.
How can I resolve this issue?
I hope that's the proper way you used because it's definitely the method I abide by (and it works).
I created a blank project in
Interface Builder(Xcode 13.4.1) as follows:I code the
UILabeltext asNSAttributedStringto follow your pattern plus some other stuff for theDynamic Typefeature:Finally, I get this result on an
iPhoneProMax(15.6.1):I don't know what's inside your code but, following this rationale, you're now able to use the Dynamic Text Sizing in NSAttributedString.