I tried this method
@IBAction func handlePan(recognizer:UIPanGestureRecognizer) { let translation = recognizer.translationInView(self.view) if let view = recognizer.view { view.center = CGPoint(x:view.center.x + translation.x, y:view.center.y + translation.y) } recognizer.setTranslation(CGPointZero, inView: self.view) }
It works, but the problem is that when I use this method for multiple images, it creates some problems, for example, when dragging one image and changing its position, but when I click and drag the second image. My first image is returning to its original position. Here are the images that I get from the scroll view: When I click on the second image, the first image also goes to its original position

I drag the image, itβs fine here.

source share