Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to embed a link in a UITextView for the iphone

I'm wondering if it is possible to put a hyperlink in a UITextView that will open up safari and take the user to a web page. And if so how can I accomplish this.

Thanks in advance for your help.

like image 717
jmurphy Avatar asked Jun 14 '09 21:06

jmurphy


2 Answers

yes, you can by setting the dataDetectorTypes property pf the UITextView to 'UIDataDetectorTypeLink '.

like image 63
Sunil mathew Avatar answered Sep 23 '22 05:09

Sunil mathew


Unfortunately not at the moment since there are no attributes you can attach to the text.

You have a couple of options

1) Use a UIWebView instead.

2) If the text is in a known position then you could overlay a button on the coordinates. This is how Twitterific on the iPhone does links,

like image 23
NeilInglis Avatar answered Sep 26 '22 05:09

NeilInglis