在 iOS 10 上处理没有通知的首选文本大小更改
UILabel
,UITextField
和 UITextView
类具有从 iOS 10 开始的新属性,用于在用户更改其首选读取大小 adjustsFontForContentSizeCategory
时自动调整其字体大小。
迅速
@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.
}