字體大小對照表
Label
1.
2.
3.
iOS 10
label.font = UIFont.preferredFont(forTextStyle:
.body)
label.adjustsFontForContentSizeCategory
= true
4.
自訂字體(iOS 11才有)
let customFont = UIFont.systemFont(ofSize: 20)
label.font = UIFontMetrics.default.scaledFont(for: customFont)
label.adjustsFontForContentSizeCategory = true
label.adjustsFontForContentSizeCategory = true
Xcode 快速驗證
取得現在字體大小
UIApplication.shared.preferredContentSizeCategory
修改字體大小的Notification
UIContentSizeCategory.didChangeNotification
0 意見:
張貼留言