[英]How to change NSAttributedString font size
如何更改已使用初始化的NSAttributedString
的字體大小
init(data: Data, options: [NSAttributedString.DocumentReadingOptionKey : Any] = [:], documentAttributes: AutoreleasingUnsafeMutablePointer<NSDictionary?>?)
實際上,我有包含html標簽的字符串,我使用的是Roger Carvalho 在此處給出的擴展名。 正確標記了html標記,但是字體與FontSizeMetrics
給出的常規標記不同:
let fontMetrics: FontSizeMetrics = FontSizeMetrics()
let font = UIFont(name: "NotoSans", size: fontMetrics.fontRegular)
在Swift 4中:
[NSAttributedStringKey.font : UIFont.boldSystemFont(ofSize: 17.0)]
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.