1

Please look at the below image, Red Color Texts are two different strings and Ash color String are another string. I concatenate those strings into one String and i assigned that string into UILabel.

i used NSMutableAttributedString for applying colors and Font styles to NSString

Now i need to show two separate Links on the Red Color Strings " SIVASAGAR" and "THE ORDER:1886", when user clicks on that links, it redirects to different views.

Is it possible to achieve this type of scenario using UIButton or STTweetlabel or something else?

NOTE: All the names ,i mean Red Color Strings Positions(X and Y values) will change Dynamically according to requirement.

enter image description here

Krishna1251
  • 177
  • 1
  • 10
  • 1
    possible duplicate of [iOS UITextView or UILabel with clickable links to actions](http://stackoverflow.com/questions/20541676/ios-uitextview-or-uilabel-with-clickable-links-to-actions) – Vizllx May 27 '15 at 12:14
  • 1
    Is that a new requirement? this function has been implemented in lot of places, you are doing the same job just detecting a link in UILabel. Just you have to customize it according to your need but the function remain same and that you can do it from the following Question link. But I have a big doubt whether you have gone through the answer? Or you may be wanting a ready-made solution then that is different . – Vizllx May 27 '15 at 12:49
  • Why you can't put your link in two lines? With this kind of thinking: http://stackoverflow.com/questions/1256887/create-tap-able-links-in-the-nsattributedtext-of-a-uilabel/29352519#29352519, detecting the range should help. – Larme May 27 '15 at 13:06

1 Answers1

1

I think you should use UITextView and add:

[attributedText addAttribute:NSLinkAttributeName value:@"yourCustomSchemeUrl://" range:linkRange];

and implement Custom URL Scheme

ChikabuZ
  • 10,031
  • 5
  • 63
  • 86