gpt4 book ai didi

ios - TTTAttributedLabel didSelectLink 未在 swift 4.0 中调用

转载 作者:行者123 更新时间:2023-11-30 11:13:01 25 4
gpt4 key购买 nike

我使用 TTTAttributedLabel,这是我的代码。当我单击链接变得金光闪闪时,但 attributeLabel(_ label: TTTAttributedLabel!, didSelectLinkWith url: URL!) 没有调用。任何人都可以帮助我。我都这样为标签设置了委托(delegate)。你能帮我一下吗?

 import TTTAttributedLabel
class MainVC : UIViewController,TTTAttributedLabelDelegate{

@IBOutlet weak var lblTerms: TTTAttributedLabel!

func setupMultipleTapLabel() {
let str = "By signing up, I agree to \(APPNAME_AND_VERSION_ABOUT.capitalized)'s Terms of Service, Privacy Policy, Guest Refund Policy, and Host Gurantee Terms." as NSString
lblTerms.text = str as String
lblTerms.delegate = self
let range : NSRange = str.range(of: "Terms of Service")
lblTerms.addLink(to: NSURL(string: "\(WebServerUrl)terms_of_service")! as URL?, with: range)
let range1 : NSRange = str.range(of: "Privacy Policy")
lblTerms.addLink(to: NSURL(string: "\(WebServerUrl)privacy_policy")! as URL?, with: range1)
let range2 : NSRange = str.range(of: "Guest Refund Policy")
lblTerms.addLink(to: NSURL(string: "\(WebServerUrl)guest_refund")! as URL?, with: range2)
let range3 : NSRange = str.range(of: "Host Gurantee Terms")
lblTerms.addLink(to: NSURL(string: "\(WebServerUrl)host_guarantee")! as URL?, with: range3)
}
func attributedLabel(_ label: TTTAttributedLabel!, didSelectLinkWith url: URL!) {
print("url \(url)")
UIApplication.shared.openURL(url)
}
}

最佳答案

我明白了..它工作正常...我使用 tab guster。所以我去掉了风口,它工作正常。

关于ios - TTTAttributedLabel didSelectLink 未在 swift 4.0 中调用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51999968/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com