swift 5.0富文本

2021-03-18 11:13:22 浏览数 (1)

代码语言:javascript复制
let myMutableString = NSMutableAttributedString(string: "100 Gained", attributes: [NSAttributedString.Key.font:UIFont(name: "Georgia", size: 18.0)!])
        myMutableString.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor.purple, range: NSRange(location:0,length:myMutableString.length - 7))
 // set label Attribute
countL.attributedText = myMutableString

0 人点赞