2

Is it possible to have a linkable text with NSAttributedString (I don't want to use UIWebView and html)?

I need a UILabel that shows the following text:

"To download the app tap here"

And tap here should be clickable so I can perform some action when user tap it.

Mario
  • 2,431
  • 6
  • 27
  • 34
  • possible duplicate of [Detecting taps on link in NSAttributedString](http://stackoverflow.com/questions/21617948/detecting-taps-on-link-in-nsattributedstring) – Gabriel.Massana Mar 20 '14 at 16:46
  • [OHAttributedLabel](https://github.com/AliSoftware/OHAttributedLabel) is what you want! – simalone Mar 20 '14 at 17:05

1 Answers1

0

This can be achieved by ResponsiveLabel. Here is the sample usage.

PatternTapResponder action = ^(NSString *tappedString){
  //Action to be performed
};
// label is of type ResponsiveLabel
[label enableStringDetection:@"Tap Here" withAttributes:@{NSForegroundColorAttributeName:[UIColor redColor],
                                                             RLTapResponderAttributeName:action}];
hsusmita
  • 282
  • 3
  • 16