Note that there are some explanatory texts on larger screens.

plurals
  1. POSave image from UIWebView to camera roll with gesture
    primarykey
    data
    text
    <p>Hi I am a little stuck saving an image, I have constructed a gesture and followed a tutorial but am a little stuck with the final part of actually saving the image. Any help would be gratefully appreciated Here is the tutorial source</p> <p><a href="http://bees4honey.com/blog/tutorial/how-to-save-an-image-from-uiwebview/" rel="nofollow">http://bees4honey.com/blog/tutorial/how-to-save-an-image-from-uiwebview/</a></p> <p>Thanks in advance</p> <pre><code> UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap:)]; doubleTap.numberOfTouchesRequired = 2; [self.myWebView addGestureRecognizer:doubleTap]; } -(void) doubleTap :(UITapGestureRecognizer*) sender { int scrollPositionY = [[self.myWebView stringByEvaluatingJavaScriptFromString:@"window.pageYOffset"] intValue]; int scrollPositionX = [[self.myWebView stringByEvaluatingJavaScriptFromString:@"window.pageXOffset"] intValue]; int displayWidth = [[self.myWebView stringByEvaluatingJavaScriptFromString:@"window.outerWidth"] intValue]; CGFloat scale = myWebView.frame.size.width / displayWidth; CGPoint pt = [sender locationInView:self.myWebView]; pt.x *= scale; pt.y *= scale; pt.x += scrollPositionX; pt.y += scrollPositionY; NSString *js = [NSString stringWithFormat:@"document.elementFromPoint(%f, %f).tagName", pt.x, pt.y]; NSString * tagName = [self.myWebView stringByEvaluatingJavaScriptFromString:js]; NSString *imgURL = [NSString stringWithFormat:@"document.elementFromPoint(%f, %f).src", startPoint.x, startPoint.y]; NSString *urlToSave = [self.myWebView stringByEvaluatingJavaScriptFromString:imgURL]; /// Stuck at this point to actually get the file </code></pre> <p>}</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload