Keshav
Keshav

Reputation: 3283

UIScrollView is going small than minimumZoomScale

I am UIScrollView and added UIImageView to it and set the delegate and implemented the delegate method

- (UIView*)viewForZoomingInScrollView:(UIScrollView *)scrollView {
    // Return the view that we want to zoom
    return self.imageView;
}

everything looks fine, I can pinch zoom in & out.

problem is: when I keep on pinching the image, the image will be too small and it will bounds back to minimumZoomScale. so I just want to stop pinch when it reaches minimumZoomScale.

Any Idea?

Upvotes: 1

Views: 847

Answers (1)

jrturton
jrturton

Reputation: 119292

Turn off zoom bouncing for the scroll view:

scrollView.bouncesZoom = NO;

From the docs:

If the value of this property is YES and zooming exceeds either the maximum or minimum limits for scaling, the scroll view temporarily animates the content scaling just past these limits before returning to them. If this property is NO, zooming stops immediately at one a scaling limits. The default is YES .

Sounds like this is what you want.

If you want bouncing on the max end but not the min end, you'll have to implement the delegate method - (void)scrollViewDidZoom:(UIScrollView *)scrollView and reset the zoom scale in that method.

Upvotes: 4

Related Questions