Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone UIWebView,启用触摸屏保存图像,如在mobile Safari中_Iphone_Ios_Image_Uiwebview - Fatal编程技术网

Iphone UIWebView,启用触摸屏保存图像,如在mobile Safari中

Iphone UIWebView,启用触摸屏保存图像,如在mobile Safari中,iphone,ios,image,uiwebview,Iphone,Ios,Image,Uiwebview,我想在用户触摸在我的应用程序的UIWebView中保存图像时启用保存图像和复制。是否有一个属性可以实现这一点,或者我需要编写一些特殊的方法来实现这一点 谢谢你的阅读 首先,您可以创建UILongPressGestureRecognitor实例并将其附加到按钮 UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(lo

我想在用户触摸在我的应用程序的UIWebView中保存图像时启用保存图像和复制。是否有一个属性可以实现这一点,或者我需要编写一些特殊的方法来实现这一点


谢谢你的阅读

首先,您可以创建UILongPressGestureRecognitor实例并将其附加到按钮

 UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
 [self.button addGestureRecognizer:longPress];
 [longPress release];
然后实现处理手势的方法

 - (void)longPress:(UILongPressGestureRecognizer*)gesture {
if ( gesture.state == UIGestureRecognizerStateEnded ) {
     NSLog(@"Long Press");

 //do something
   }
 }

查看此链接,谢谢!但是如何使UIWebView中按下的图像成为一个按钮呢?就像你可以把一个webview Constome按钮放在上面,然后你可以得到UIButton事件…:)
UIImage * downloadImage = [[UIImage alloc] initWithContentsOfFile:path];
    UIImageWriteToSavedPhotosAlbum(downloadImage,nil, nil, nil);
    [downloadImage release];

    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Saved" message:@"Wallpaper saved to your Gallery." delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil, nil];

    [alert show];
    [alert release];

Add this whole code to your long press method, it will save your image in gallery.