Skip to content

补充属性设置方式

Compare
Choose a tag to compare
@lixiang1994 lixiang1994 released this 22 Apr 10:45
· 25 commits to master since this release
var string = ASAttributedString("XXX")
string.add(attributes: [.foreground(.red)], range: .init(location: 0, length: string.length))
string.set(attributes: [.foreground(.red)], range: .init(location: 0, length: string.length)) 
label.attributed.text = string

equal

label.attributed.text = ASAttributedString("XXX").add(attributes: .foreground(.red)).set(attributes: .foreground(.red))