According to apple documentation pinching is a continuous gesture & mean to be use with two fingers. Even with three finger pinching it seems working fine in swift 4.1.
I tried to print number of touches. Even with three fingers it gives number of touches as 2. It seems it detects first 2 finger touches and ignore third.So no way to filter.
@objc func pinch(pinchGesture: UIPinchGestureRecognizer){
if pinchGesture.state == UIGestureRecognizerState.began {
print("number of touches:\(pinchGesture.numberOfTouches)")
}
}
I am calling setupGesture() method in viewDidLoad. So it handles relevant user pinch gestures.
func setupGestures(){
let pinch = UIPinchGestureRecognizer(target: self, action: #selector(self.pinch))
pinch.delegate = self
self.addGestureRecognizer(pinch)
}
Is there any possible way to avoid three finger pinching in ios?