| | |
| | | |
| | | |
| | | textView_treaty.isEditable = false |
| | | textView_treaty.linkTextAttributes = [.foregroundColor:UIColor.black.withAlphaComponent(0.8)] |
| | | textView_treaty.linkTextAttributes = [.foregroundColor:UIColor(hexStr: "#3a9edc").withAlphaComponent(0.8)] |
| | | let paragraphStyle = NSMutableParagraphStyle() |
| | | paragraphStyle.lineBreakMode = NSLineBreakMode.byCharWrapping |
| | | paragraphStyle.lineSpacing = 3 |
| | | paragraphStyle.lineSpacing = 5 |
| | | |
| | | let content = "我已阅读并同意《隐私协议》《用户协议》《运动安全告知书》" |
| | | let content = "我已阅读并同意\n《隐私协议》\n《用户协议》\n《运动安全告知书》" |
| | | let attribute = NSMutableAttributedString(string: content) |
| | | attribute.addAttribute(.foregroundColor, value: UIColor.black.withAlphaComponent(0.6), range: NSRange(location: 0, length: content.count)) |
| | | attribute.addAttribute(.font, value: UIFont.systemFont(ofSize: 12, weight: .medium), range: NSRange(location: 0, length: content.count)) |
| | | attribute.addAttributes([NSAttributedString.Key.link:URL(string: "tip://treaty")!], range: content.jq_subRange("《隐私协议》")!) |
| | | attribute.addAttribute(NSAttributedString.Key.underlineStyle, value: NSNumber(value:NSUnderlineStyle.single.rawValue), range: content.jq_subRange("《隐私协议》")!) |
| | | attribute.addAttribute(.underlineColor, value: UIColor(hexStr: "#3a9edc"), range: content.jq_subRange("《隐私协议》")!) |
| | | |
| | | attribute.addAttributes([NSAttributedString.Key.link:URL(string: "tip://user")!], range: content.jq_subRange("《用户协议》")!) |
| | | attribute.addAttribute(NSAttributedString.Key.underlineStyle, value: NSNumber(value:NSUnderlineStyle.single.rawValue), range: content.jq_subRange("《用户协议》")!) |
| | | attribute.addAttribute(.underlineColor, value: UIColor(hexStr: "#3a9edc"), range: content.jq_subRange("《用户协议》")!) |
| | | |
| | | |
| | | attribute.addAttributes([NSAttributedString.Key.link:URL(string: "tip://sportSafety")!], range: content.jq_subRange("《运动安全告知书》")!) |
| | | attribute.addAttribute(NSAttributedString.Key.underlineStyle, value: NSNumber(value:NSUnderlineStyle.single.rawValue), range: content.jq_subRange("《运动安全告知书》")!) |
| | | attribute.addAttribute(.underlineColor, value: UIColor(hexStr: "#3a9edc"), range: content.jq_subRange("《运动安全告知书》")!) |
| | | |
| | | |
| | | attribute.addAttributes([.paragraphStyle:paragraphStyle], range: _NSRange(location: 0, length: content.count)) |
| | | self.textView_treaty.attributedText = attribute |
| | | self.textView_treaty.delegate = self |