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

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-16
  • 2021-06-12
  • 2021-12-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案