optonaut / ActiveLabel.swift

UILabel drop-in replacement supporting Hashtags (#), Mentions (@) and URLs (http://) written in Swift

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Last element is sign can not custom

MusickMe opened this issue · comments

        let userAgreement = ActiveType.custom(pattern: "\\s<用户协议> \\b")
        let privacyPolicy = ActiveType.custom(pattern: "\\s<隐私协议>\\b")
        tip.enabledTypes.append(userAgreement)
        tip.enabledTypes.append(privacyPolicy)
        tip.customize { lable in
            tip.textColor = .JX_COLOR_C2
            tip.font = .Regular_12
            tip.textAlignment = .center
            tip.text = "登录注册即表示同意该App <用户协议> 和 <隐私协议>"
            tip.customColor[userAgreement] = .JX_COLOR_48
            tip.customSelectedColor[userAgreement] = .JX_COLOR_C2
            tip.customColor[privacyPolicy] = .JX_COLOR_48
            tip.customSelectedColor[privacyPolicy] = .JX_COLOR_C2
            tip.handleCustomTap(for: userAgreement) { text in
                print(text)
            }
            tip.handleCustomTap(for: privacyPolicy) { text in
                print(text)
            }

if the last element is sign, the last element can not custom, if write "<隐私协议" can custom, but "<隐私协议>", all "<隐私协议>" do not custom

let userAgreement = ActiveType.custom(pattern: "\s<用户协议> \b")
let privacyPolicy = ActiveType.custom(pattern: "\s<隐私协议>\B")

let userAgreement = ActiveType.custom(pattern: "\s<用户协议> \b")
let privacyPolicy = ActiveType.custom(pattern: "\s<隐私协议>\B")

        let userAgreement = ActiveType.custom(pattern: "\\s<用户协议> \\b")
        let privacyPolicy = ActiveType.custom(pattern: "\\s<隐私协议>\\B")

Thanks a lot,I understand what you mean. And should be written like this. so, it's mean the last element must user "/B" ?

commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

let customType = ActiveType.custom(pattern: "用户协议 | 隐私协议")