0

I use TTTAttributedLabel, this is my code. When I click the Link getting bling, but attributedLabel(_ label: TTTAttributedLabel!, didSelectLinkWith url: URL!) is not calling. any one help me. I all so set the delegate for the label. can you please help me.

 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)
   }
}
mouni
  • 327
  • 1
  • 3
  • 15

1 Answers1

0

I got it.. it's working fine... I use tab guster. so I remove the guster it's working fine.

mouni
  • 327
  • 1
  • 3
  • 15