【问题标题】:Tap and hold to save image in UIWebview点击并按住以将图像保存在 UIWebview 中
【发布时间】:2015-07-20 16:52:06
【问题描述】:

在我的应用程序中,我有一个显示图片列表的 UIWebView。现在,当有人点击并按住图片时,会出现复制该图片的选项。

有没有办法让它在有人点击并按住时出现保存该图片的选项?

欢迎任何想法!

【问题讨论】:

    标签: objective-c image uiwebview


    【解决方案1】:

    您需要检测长按。为此,您需要添加:

     @property (nonatomic,strong) UILongPressGestureRecognizer *lpgr;
    

    在你看来确实加载了:

      self.lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPressGestures:)];
    self.lpgr.minimumPressDuration = 1.0f;
    self.lpgr.allowableMovement = 100.0f;
    
    [self.view addGestureRecognizer:self.lpgr];
    

    并在应用检测到长按时要求用户保存图片。

       - (void)handleLongPressGestures:(UILongPressGestureRecognizer *)sender
    {
        if ([sender isEqual:self.lpgr]) {
            if (sender.state == UIGestureRecognizerStateBegan)
            {  
               //prompt the user to save the picture .
            }
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2015-10-18
      • 1970-01-01
      • 2012-12-25
      • 2011-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多