简体   繁体   English

平移UIImageView不会删除原始图像

[英]Panning UIImageView doesn't remove original image

I have tried both TouchMoves and UIPanGestureRecognizer, my panned image draws to the new location but original image still shows. 我已经尝试了TouchMoves和UIPanGestureRecognizer,我的平移图像会绘制到新位置,但原始图像仍会显示。 Sending the setNeedsDisplay to the uiimageview being panned or to the superview also doesn't help. 将setNeedsDisplay发送到要平移的uiimageview或超级视图也无济于事。 What are my options to solve the situation. 我有什么解决方案。 在此处输入图片说明

This is what you can use, the code will start pan the image in ImageView 这是您可以使用的代码将开始在ImageView中平移图像

 @IBAction func startPanning(_ sender: UIPanGestureRecognizer) {

        switch sender.state{
        case .began: break

        case .changed:
            imageV.center = sender.translation(in: self.view)
            break


        case .ended: break
        default : break

        }

    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM