1

how to retrieve a link from text view. When user click an link , i need to capture that link. Any way to do that ?

Sandeep Kumar
  • 1,595
  • 1
  • 12
  • 19

2 Answers2

1

Just implement -application:handleOpenURL: in your app delegate. Return NO to avoid opening the URL.

Just subclass UIApplication and override its -openURL: method, e.g.

-(BOOL)openURL:(NSURL*)theURL {
   if (shouldOpenURL(theURL))
     return [super openURL:theURL];
   else
     return NO;
}
Community
  • 1
  • 1
kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005
  • Wrong answer. The application:handleOpenURL is called, when external party tries to open some URL using your application. This question was about catching url opening within same application --> use UIWebView. – JOM Aug 27 '10 at 07:20
0

You cannot detect clicks in regular UITextView. If you want that functionality, use UIWebView instead, and implement UIWebViewDelegate, so you can intercept clicks by implementing this method

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
reflog
  • 7,587
  • 1
  • 42
  • 47