In the Developer Documentation "UIKit-touches presses gestures-UIPinchGestureRecognizier-var: scale". In the section of Discussion, it said"You may set the scale factor, but doing so resets the velocity......Apply the scale value to the state of the view when the gesture is first recognized—do not concatenate the value each time the handler is called." What does it exactly mean?Something about "incremental" "exponential"?
If I remember well, scale must be reset in .changed.
That is the same situation as for pan gestures.
Could you try making distinction between the 2 cases:
@objc func adjustFaceCardScale(byHandlingGestureRecognizerBy recognizer: UIPinchGestureRecognizer){
switch recognizer.state {
case .changed:
faceCardScale *= recognizer.scale
recognizer.scale = 1.0
case .ended:
faceCardScale *= recognizer.scale
// recognizer.scale = 1.0
default:
break
}
}
Make a few test, commenting out:
- neither line 05 nor line 08 : that should work as it works now
- both line 05 and line 08 : that should NOT work as it does not work now
- only line 08 : my assumption is that it works
- only line 05 : my assumption is that it does not work