0

I am using TTTAttributedLabel for URLs and phone number in my app. Every thing is working fine but the problem is that now I need to show icon in the UILabel. Before I am using given below code. But due to use of TTTAttributedLabel now NSTextAttachment is not showing in TTTAttributedLabel. TTTAttributedLabel does not support attachment. So any idea to support URLs, phone numbers and icons in UILabel?


now i decided to show unicode image in TTTAttributedLabel. and it is working fine.

Iqbal Khan
  • 4,416
  • 6
  • 41
  • 78
  • Have a look at this [Topic] (http://stackoverflow.com/questions/6130475/adding-images-to-uiactionsheet-buttons-as-in-uidocumentinteractioncontroller) specifically the answer by Eddie. I use it and it has been approved in my most recent application. Just take heed to the warnings. There is a variance in OSs so it can alter without notice to you. But it could potentially fit in the scope of your goal. – soulshined Dec 31 '14 at 07:13
  • thanks i think i can use unicode – Iqbal Khan Dec 31 '14 at 08:16
  • but how to use it. i set \u1F318 and it shows me different thing in iphone simulator as given in documnetation – Iqbal Khan Dec 31 '14 at 08:16

1 Answers1

1

It's better to use UITextView and set the textView's data detector types.

textView.dataDetectorTypes = UIDataDetectorTypeAddress | UIDataDetectorTypeLink |     UIDataDetectorTypePhoneNumber;

There is one delegate methods that is called when the link or url in the text view is selected

- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange NS_AVAILABLE_IOS(7_0);

This gives you the URL tapped inside your text view and you can perform your desired action.

Henit Nathwani
  • 432
  • 3
  • 10