Handling Preferred Text Size Change Without Notifications on iOS 10
suggest changeUILabel
, UITextField
, & UITextView
classes have a new property starting from iOS 10 for automatically resizing their font when a user changes their preferred reading size named adjustsFontForContentSizeCategory
.
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