0

I have a UILabel displaying NSAttributedString for Terms of service and privacy policy. How Can I achieve Tap gesture with in the range of "Terms of service" and "privacy policy".

I want to push new view controller when user taps on "Terms of service" and "privacy policy".

Thanks

Action in Terms of service and privacy policy

SAURABH SANWAL
  • 139
  • 1
  • 11
  • 3
    Prefers a `UITextView` instead of a `UILabel`. A `UILabel` is not done for user interactions. It can be changed to do so, but that's not it's first purpose. You can look for your issue (UILabel + Touch) or look for `UITextViewDelegate` methods (one detect when user tap on a link). – Larme Aug 09 '17 at 15:07
  • The answer in the "duplicate" is correct, although it's much simpler to use UITextView and its `shouldInteractWith` delegate method – mag_zbc Aug 09 '17 at 15:09
  • add a button over your label having same constraint as UILabel. Make button backgroud clearColor and remove its text. add action to button. or you can also use just button and set its attributedtitle. – Aadil Ali Aug 09 '17 at 15:12
  • UITextView delegate func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange) works for me. – SAURABH SANWAL Aug 10 '17 at 10:23

0 Answers0