一丶介绍
添加点击事件
Paste_Image.png
二丶使用
第三方:
https://github.com/optonaut/ActiveLabel.swift
自定义方法的使用
var protocolLabel:ActiveLabel? = nil
if protocolLabel == nil {
protocolLabel = ActiveLabel()
let customType = ActiveType.custom(pattern: "\\《奇乐现金用户使用协议》")
protocolLabel?.enabledTypes = [customType]
protocolLabel?.numberOfLines = 2
protocolLabel?.text = "点击注册按钮,即表示您同意《奇乐现金用户使用协议》"
protocolLabel?.font = kFontSize_14
protocolLabel?.customColor[customType] = kColor_459ACA
protocolLabel?.textColor = kColor_TabBar_normal
protocolLabel?.handleCustomTap(for: customType, handler: { (customType) in
print("1111111")
})
self.view.addSubview(protocolLabel!)
protocolLabel?.frame = CGRect.init(x: 0, y: 0, width: 182, height: 40)
protocolLabel?.center = CGPoint.init(x: kScreenW * 0.5, y: 518)
}
三丶总结
挺方便的.
网友评论