一款可以根据传入的正则表达式自动匹配文本中的子文本对象,子文本对象按自定义方式显示和事件交互处理的UILabel。
- 支持正则匹配子文本
- 支持文字改变时自适应高度
@IBOutlet weak var testLbl: TGLabel!
override func viewDidLoad() {
super.viewDidLoad()
// testLbl.autoresizingHeight = true
testLbl.text = "TGLabel 感谢你使用TGLabel 欢迎你star/issue https://github.com/targetcloud/TGLabel"
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
testLbl.autoresizingHeight = true
testLbl.text = "我变了,我真的变了,https://github.com/targetcloud/TGLabel https://github.com/targetcloud https://github.com"
}
patterns 正则
delegate 代理
adjustCoefficient 选中时的高度调整系数
autoresizingHeight 自适应高度
selectedBackgroudColor 选中背景色
linkTextColor 选中色
text 文本
attributedText 同上
font 字体
textColor 普通文本色
-
下载并拖动TGLabel到你的工程中
-
Cocoapods
pod 'TGLabel'
如果你觉得赞,请Star