tags:

views:

48

answers:

1

Currently I have a UITextView field with the CheckBox "Detect Links" checked. The contents of the field will always be an email address.

What I want to do is allow the users to tap the email address and the mail composer open inside of my app.

I have read how you implement sending an email inside of your app using MFMailComposeViewController but how do I capture the user touching the email address, in the UITextView, and send it to my mail composer code instead of the default action?

A: 

Since UITextView does not support intercepting taps on links, you would probably have to subclass UIApplication to override its openURL: method. I'm not even sure if this will work. If you want to go that route, note that you have to make your UIApplication subclass known to the system in the call to UIApplicationMain() in main.m and in MainWindow.xib.

Ole Begemann
OK, I'm showing my ignorance. I've got my subclass capturing the email being touched.How do I open the MFMailComposeViewController from my subclass?[self presentModalViewController ] does not exist when I'm in that subclass.
hobbyman
One option is to send a custom NSNotification and have your view controller observe it.
Ole Begemann
Excellent! I got it working with your help.
hobbyman