0

There is one link in my UITextView. When I click on it, safari browser opens up and the web page for that link gets opened. But, the functionality I want is, when user will click on that link in textView, one form with webView will get opened and that web page for that link will be viewed to the user inside the application. I am not getting how to do it. I mean, How to get that click event for that link on the UITextView?? Please help me for this. The thing I want is , get an event for click on the link in UITextView..

Thanks.

Sid
  • 407
  • 1
  • 9
  • 17

1 Answers1

1

There is an answer on this question. Below is the code that allows for intercepting that click. Be sure to read the entire answer, however, because it has a few details you need to be mindful of. All credit goes to @Felz.

@interface MyApplication : UIApplication {

}

@end

@implementation MyApplication


-(BOOL)openURL:(NSURL *)url{
    if  ([self.delegate openURL:url])
         return YES;
    else
         return [super openURL:url];
}
@end
Community
  • 1
  • 1
Ryan Wersal
  • 3,210
  • 1
  • 20
  • 29
  • Hello Ryan, Thanks for the answer. But, please help me to get out of one confusion. Now, I am using one ViewController, and in the xib file, I have taken that UITextView. So, how do I make a code with the help of your answer?? Coz, you have used UIApplication. Please give me some solution for this. – Sid May 02 '11 at 03:59
  • Did you follow the link to the other question? @Felz has a very thorough answer that details his solution to your problem. – Ryan Wersal May 02 '11 at 04:01