I want to get a callback when my UIPinchGestureRecognizer finished a pinch-gesture. Moreover it would be great to know if the finished gesture was a zoom in or a zoom out.
Does anyone know a method to use? Or the approach to do?
Thanks!
Overview. A pinch gesture is a continuous gesture that tracks the distance between the first two fingers that touch the screen. Use the UIPinchGestureRecognizer class to detect pinch gestures. You can attach a gesture recognizer in one of these ways: Programmatically.
Once zoomed in, you can move around and look at parts of the video closer. This feature looks to be made specifically for portrait mode viewing. If you're a Premium member, you can find the new feature in the YouTube app on Android; just tap your profile photo and then hit Your Premium benefits.
Detecting a pinch gesture is similar to a scroll gesture, we simply want to make sure that there are 2 fingers, they have moved beyond a certain threshold and that they are moving in opposite directions. That last bit there in italics is the difference between a scroll and a pinch.
Think about what a pinch event is: two fingers on an element, moving toward or away from each other. Gesture events are, to my knowledge, a fairly new standard, so probably the safest way to go about this is to use touch events like so: ( ontouchstart event) if (e. touches.
Another approach instead of overriding touchesEnded:, is that you could just check the state of the gesture recognizer in your target handler method.
-(void)handlePinchGesture:(UIGestureRecognizer*)gestureRecognizer {
if(UIGestureRecognizerStateEnded == [gestureRecognizer state]){
// do something
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With