Handling Preferred Text Size Change Without Notifications on iOS 10
suggest changeUILabel, UITextField, and UITextView have adjustsFontForContentSizeCategory starting in iOS 10. It updates the font when the user changes the preferred reading size only if that font came from UIFont.preferredFont(forTextStyle:). A fixed font size does not change.
Swift
@IBOutlet var label:UILabel!
if #available(iOS 10.0, *) {
label.adjustsFontForContentSizeCategory = true
} else {
// Observe for UIContentSizeCategoryDidChangeNotification and handle it manually
// since the adjustsFontForContentSizeCategory property isn't available.
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents