let attributes2 NSAttributedStringKey Any = font font 怎么添加文字颜色
要添加文字颜色,可以在attributes2字典中添加NSAttributedString.Key.foregroundColor属性,指定颜色值。例如:
let attributes2: [NSAttributedString.Key: Any] = [.font: font, .foregroundColor: UIColor.red]
这样就将文字的颜色设置为红色。你可以根据需要将UIColor替换为其他颜色。
原文地址: http://www.cveoy.top/t/topic/jbse 著作权归作者所有。请勿转载和采集!