UILongPressGestureRecognizer *gs = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(p_gestureRecognizerAction:)];
gs.numberOfTouchesRequired = 1;
[self.view addGestureRecognizer:gs];
- (void)p_gestureRecognizerAction:(UIGestureRecognizer *)gestureRecognizer {
if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {
CGPoint touchPoint = [gestureRecognizer locationInView:gestureRecognizer.view];
if(self.interfaceOrientation == UIInterfaceOrientationPortrait || self.interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
NSString *imgURL = [NSString stringWithFormat:@"document.elementFromPoint(%f, %f).src", touchPoint.x, touchPoint.y];
_urlToSave = [self.webview stringByEvaluatingJavaScriptFromString:imgURL];
NSLog(@"urlToSave :%@",_urlToSave);
}
}
}