I query a SQLite db and the query returns some links: I can display them in a UITextView or in a UIWebView.
What I need to know is: is there a way to bind an action to a link inside a UIWebView (or even UITextView)? I don’t want to open a webpage, I just want to execute a method of Objective-C as the link was a button. Is this possible?
Use the delegate method
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)aRequest navigationType:(UIWebViewNavigationType)navigationTypeand check for
UIWebViewNavigationTypeLinkClicked, then inspect the[aRequest URL]to determine what the link action should be.