swift label不同颜色、不同字体
let string = "点击注册按钮,即表示您已同意隐私条款和服务协议"
let ranStr = "同意"
let attrstring:NSMutableAttributedString = NSMutableAttributedString(string:string)
let str = NSString(string: string)
let theRange = str.range(of: ranStr)
attrstring.addAttribute(NSForegroundColorAttributeName, value: UIColor.red, range: theRange)
attrstring.addAttribute(NSFontAttributeName, value: UIFont.systemFont(ofSize: 14), range: theRange)
label.attributedText = attrstring
群号:186052819