【发布时间】:2020-01-28 11:15:58
【问题描述】:
大家好,我有一个小问题,我正在使用 func:
static func convertFromHTMLString(_ input: String?) -> NSAttributedString? {
guard let input = input else { return nil }
guard let data = input.data(using: String.Encoding.unicode, allowLossyConversion: true) else { return nil }
return try? NSAttributedString(data: data, options: [NSAttributedString.DocumentReadingOptionKey.documentType : NSAttributedString.DocumentType.html], documentAttributes: nil)
}
从 Localizable.strings 中读取我的字符串,属性如下:
但是当我运行我的应用程序时,它看起来:
这会将我的标签颜色更改为黑色,字体大小更改为 10-12 ;/ 我的标签应该是白色,字体大小为 17,有人知道如何解决吗? 谢谢 ! :)
【问题讨论】:
标签: html swift string nsattributedstring