As pointed out in this answer , you can set the dataDetectorTypes property for a UITextView :
textview.editable = NO; textview.dataDetectorTypes = UIDataDetectorTypeAll;
You should also be able to set type identifiers in Interface Builder.
From Apple Documentation :
UIDataDetectorTypes
Defines the types of information that can be detected in text-based content. enum { UIDataDetectorTypePhoneNumber = 1 << 0, UIDataDetectorTypeLink = 1 << 1, UIDataDetectorTypeAddress = 1 << 2, UIDataDetectorTypeCalendarEvent = 1 << 3, UIDataDetectorTypeNone = 0, UIDataDetectorTypeAll = NSUIntegerMax }; typedef NSUInteger UIDataDetectorTypes;
When you click on an email address in UITextView, the Mail application automatically opens.
On the side of the note, if you want to send an email from the application itself, you can use MFMailComposeViewController.
Please note that in order to display the MFMailComposeViewController, the device must have the Mail application installed and have an account associated with it, otherwise your application will fail.
So, you can check this using [MFMailComposeViewController canSendMail] :
// Check that a mail account is available if ([MFMailComposeViewController canSendMail]) { MFMailComposeViewController * emailController = [[MFMailComposeViewController alloc] init]; emailController.mailComposeDelegate = self; [emailController setSubject:subject]; [emailController setMessageBody:mailBody isHTML:YES]; [emailController setToRecipients:recipients]; [self presentViewController:emailController animated:YES completion:nil]; [emailController release]; } // Show error if no mail account is active else { UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"Warning" message:@"You must have a mail account in order to send an email" delegate:nil cancelButtonTitle:NSLocalizedString(@"OK", @"OK") otherButtonTitles:nil]; [alertView show]; [alertView release]; }
MFMailComposeViewController class reference
source share