Closed FPJack closed 1 year ago
@FPJack 相关代码发一下 我复现看看
let label = UILabel.init(frame: CGRect(x: 50, y: 100, width: 200, height: 20))
view.addSubview(label)
label.adjustsFontSizeToFitWidth = true
let attr1 = ASAttributedString(string: "I have read and agree the ",.font(.systemFont(ofSize: 10)),.foreground(.black))
let attr2 = ASAttributedString(string: "User Agreement ", .font(.systemFont(ofSize: 10)),.foreground(.orange),.action(ASAttributedString.Action(highlights: [.foreground(.orange.withAlphaComponent(0.5))]) { _ in
}))
let attr3 = ASAttributedString(string: "and ",.font(.systemFont(ofSize: 10)),.foreground(.black))
let attr4 = ASAttributedString(string: "Privacy Policy ",.font(.systemFont(ofSize: 10)),.foreground(.orange),.action(ASAttributedString.Action(highlights: [.foreground(.orange.withAlphaComponent(0.5))]) { _ in
}))
label.attributed.text = attr1 + attr2 + attr3 + attr4
已修复 3.3.5
adjustsFontSizeToFitWidth = true 的时候 一行展示不下的时候 文字里面有点击部分点击会崩溃