繁体   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