-4

Using the following method to detect how many point move in pinch action (using UIPinchGestureRecognizer), I have to get the value of point move the view in iOS device screen.

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {

}
p t
  • 3
  • 5
  • For more Help : stackoverflow.com/q/30505165/10763400 and stackoverflow.com/a/30505216/10763400 – p t Dec 15 '18 at 12:14
  • Also see this link : https://www.reddit.com/r/swift/comments/5pjjem/how_to_move_a_uiimageview_around_a_predetermined/ – p t Dec 15 '18 at 12:15

1 Answers1

-1

Using following 02 delegate method to getting how many point move in pinch action., before creating one global variable oldPoint

var oldPoint = CGPoint()

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        print("touchesBegan")


        let touch : UITouch = touches.first!
        self.oldPoint = touch.location(in: self.viewAnimate)
    }

    override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
        print("touchesMoved")
        StartRecording()

        let touch : UITouch = touches.first!
        let newPoint = touch.location(in: self.viewPinch)

        print("oldPoint : \(oldPoint)")
        print("newPoint : \(newPoint)")
}

and you will be given output log is,

touchesBegan
touchesMoved
oldPoint : (54.0, 55.0)
newPoint : (52.0, 52.0)
touchesMoved
oldPoint : (54.0, 55.0)
newPoint : (52.0, 51.0)
touchesMoved
oldPoint : (54.0, 55.0)
newPoint : (52.0, 49.0)
touchesMoved
oldPoint : (54.0, 55.0)
newPoint : (52.0, 48.0)
p t
  • 3
  • 5
  • For more Help : https://stackoverflow.com/q/30505165/10763400 and https://stackoverflow.com/a/30505216/10763400 – p t Dec 15 '18 at 12:14