2

I'm trying to do something like Snapchat does, while you are recording, if you drag upwards your finger, the video is zoomed. Does anyone know how to do it in Swift3 or if there's a pod that I can based on.

I'm using SCRecorder to record the video, which is based on AVFoundation Framework.

Here's a link of a video showing exactly what I want to do.

Thank you!

Ian
  • 1,221
  • 1
  • 18
  • 30
gutiago
  • 129
  • 3
  • Would you still like the answer to this? – gbhall Jun 26 '17 at 14:24
  • Hey, I've already implemented my own way of doing it. But thanks for the attention. – gutiago Jun 26 '17 at 14:48
  • That's no problem, if you still want to see an alternative version let me know. – gbhall Jun 26 '17 at 14:50
  • @gbhall Could you please provide me the solution? I want to do the same please Help! – Khush Dec 20 '18 at 05:39
  • @GustavoTiago How did you solved this? – Khush Dec 20 '18 at 05:39
  • It's been a year since I've did it, but If I'm not wrong, I added an UILongPressGesture to the button and as the user translate the finger in the screen, I get the Y position and calculate it with a formula to create the zoom. You just need to define an equation that you can put the Y and that gives you a reasonable zoom. – gutiago Jan 09 '19 at 15:35

1 Answers1

0

this solution might be helpful for others.You can use long press gesture to start recording video and pan gesture simultaneously to zoom upwards and downwards to zoom back.

    let longGesture = UILongPressGestureRecognizer(target: self, action: #selector(handleLongPress))
    let panGestureRecognizer = UIPanGestureRecognizer(target: self, action: #selector(handlePanGesture))

    longGesture.delegate = self
    panGestureRecognizer.delegate = self
    
    self.addGestureRecognizer(panGestureRecognizer)
    self.addGestureRecognizer(tapGesture)
    self.addGestureRecognizer(longGesture)

extension CameraButton: UIGestureRecognizerDelegate {
func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
    return true
}

}

  • This is only 25% of a complete answer to the question. You have only shown how to recognize 2 gestures at once. What is the code for the 2 selectors. And wrap things in an example class. – Jeff Feb 08 '22 at 01:44