Ios – How to make UITextView detect links for website, mail and phone number


I have a UITextView object. The text in UIView has a phone number, mail link, a website link. I want to show them as links with following functionality.

When someone taps on URL – Safari should open the the website.
When someone taps on email link – Mail should open up with my address in to field
When someone taps on phone number – Phone application should call the number

Has anyone done this before or knows how to handle it?


Best Solution

If you are using OS3.0

you can do it like the following

textview.editable = NO;
textview.dataDetectorTypes = UIDataDetectorTypeAll;
Related Question