【问题标题】:iPhone webapp disabling touch & hold to save imageiPhone webapp禁用触摸并按住以保存图像
【发布时间】:2012-12-25 17:33:20
【问题描述】:

我遇到了一个小问题。 我有一个适用于 iPhone 的移动网络应用程序... 我的移动网站需要用户能够触摸并按住图像才能将其保存到手机中。 但是,当作为 web 应用程序打开时,与常规 safari 浏览器不同,当您触摸按住和图像时,不会出现保存图像的对话框。

我需要在触摸并按住图像时显示此对话框...

有什么帮助让它工作吗? 先谢谢了!

【问题讨论】:

    标签: iphone web-applications mobile


    【解决方案1】:

    首先检测用户点击图片并实际找出他们点击的图片网址。之后使用下面的代码下载并保存图像。检测图像使用此链接中的代码:Customise Uiwebview

    UIImage * downloadImage = [[UIImage alloc] initWithContentsOfFile:path];
    UIImageWriteToSavedPhotosAlbum(downloadImage,nil, nil, nil);
    
    
    UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Saved" message:@"Wallpaper saved to your Gallery." delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil, nil];
    [alert show];
    

    它将您的图像保存在图库中。

    来源:UIWebView, enable touch hold save image, like in mobile Safari

    你也可以试试这个链接:Customise Uiwebview

    【讨论】:

    • 我很抱歉造成误解......但它是一个网络应用......基于 html......不过感谢您的回答!
    • 您是否检查了自定义 UIwebview 链接:iky1e.tumblr.com/post/5109242276/… 这里有人使用一些 javascript (JStools.js) 来检测图像链接。希望对您有所帮助。
    • 我认为您必须使用一些插件,例如:如果您使用的是 Phonegap,则有一个名为 Child Browser 的插件(不确定,因为我在 8 个月之前使用过)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-11
    • 1970-01-01
    • 2015-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多