簡體   English   中英

如何更改NSAttributedString字體大小

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM