问题
Running into a problem with UIWebview, it doesn't seem to react to gesture recognizer. I would like to get a popover to appear whenever I do a long press on a link (or image) with different actions.
Any help would be greatly appreciated =). Thanks.
回答1:
You can detect clicking on a URL like this
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request
navigationType:(UIWebViewNavigationType)navigationType {
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
NSURL *URL = [request URL];
if ([[URL scheme] isEqualToString:@"http://"]) {
//It is a URL
}else{
//Not a URL
}
return YES;
}
来源:https://stackoverflow.com/questions/4009760/detect-long-press-on-uiwebview-and-pop-up-a-menu-if-im-pressing-on-a-link