How to Add tap gesture to part of NSAttributedString? [duplicate]

This question already has an answer here:

I am using a UILabel. setting its attributed text. I want to add tap gesture to part of string rather than part of label. Because my UILabel is a multiline one. So i can’t add gesture to part of label.

Please guide me so that i can be able to add gesture to part of string.
For example: lblObject.text = @”Hi Abdul, did you see my BACKBONE book.”
Now that i want to add gesture to BACKBONE text only. Please suggest

enter image description here

I want to add tap gesture to the underlined text . Both the red box are a single text in two different lines.

Source: New Questions


  1. Edwin

    You need to use the hyperlink functionality of attributed string. That’s not easy out of the box but has been around a while and can do most of the heavy lifting leaving you to implement a delegate.

  2. Weldon

    Hello to every , since I am truly keen of reading this website’s post to
    be updated daily. It carries nice information.


    Having read this I believed it was rather informative.
    I appreciate you spending some time and effort to put this short article together.
    I once again find myself spending a significant amount of time both reading and commenting.
    But so what, it was still worth it!


    Very good information. Lucky me I found your site by accident (stumbleupon).
    I have bookmarked it for later!


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.