I have a UIViewController, which uses a UIScrollView and within that Scrollview it has a UIImageView.
I want to recognize a pinch and zoom accordingly. I don’t need to scale, i just need to show a different image.
It pretty much looks like this question: UIView UIPinchGestureRecognizer problem
I have tried several things:
-
set contentMode to
UIViewContentModeScaleAspectFit -
set
multipleTouchEnabled = YES -
set
userInteractionEnabled = YES
And yet, it still not always catches the pinching event.
Here is how I assign the gesture to the view, pretty straightforward:
UIPinchGestureRecognizer *pinchRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(zoomPinch:)];
[MediaScroller addGestureRecognizer:pinchRecognizer];
[pinchRecognizer release];
Also, I do notice that the scrollViewDidEndZooming is called of my delegate, but the scale variable is always 1.0. How can that be?
The scrollViewDidEndZooming is always called, while the pinch method (zoomPinch) is not always called. Any reasons why that would happen? And how can I fix it? 🙂
I believe you need to implement this in your
recognizer delegate:then, on self class:
As the class already recognizes pinch (for zoom), maybe you need to enable to have more than one handler for pinch.