Is it possible to perform custom action when user touch autodetected phone link in UITextView. Please do not advice to use UIWebView instead.
And please don’t just repeat text from apple classes reference
– certainly I’ve already read it.
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Update: From ios10,
From ios7 and Later
UITextViewhas the delegate method:to intercept the clicks to links. And this is the best way to do it.
For ios6 and earlier a nice way to do this is to by subclassing
UIApplicationand overwriting the-(BOOL)openURL:(NSURL *)urlYou will need to implement
openURL:in your delegate.Now, to have the application start with your new subclass of
UIApplication, locate the file main.m in your project. In this small file that bootstraps your app, there is usually this line:The third parameter is the class name for your application. So, replacing this line for:
This did the trick for me.