Skip to content

Instantly share code, notes, and snippets.

@hanfengs
Created December 15, 2021 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanfengs/3c0bd681651ddc8016ac9a5a7635b076 to your computer and use it in GitHub Desktop.
Save hanfengs/3c0bd681651ddc8016ac9a5a7635b076 to your computer and use it in GitHub Desktop.
[swift的AttributedString用法]
let descString = "delete_account_check_des".localization as NSString
let range = descString.range(of: "DELETE")
let attributes = NSMutableAttributedString(string: descString as String)
attributes.addAttribute(NSAttributedString.Key.foregroundColor, value: UIColor(red: 255, green: 0, blue: 8), range: range)
deleteTyptDescLable.attributedText = attributes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment