1
votes

I am using UIScrollView for zooming an image. While to zoom out the image I want it to be put on double tap.

So my question is can it be possible to zoom out zoomed image on double tap. (I am able to detect the double tap on zoomed view).

Which property we can use for this of Scroll View.

3
Just be aware that this will be counter-intuitive and I would avoid it. Generally, double tapping zooms in not out. - David Kanarek

3 Answers

2
votes

You probably want to use the UIScrollView method scrollRectToVisible:animated:. You'll pass it the CGRect that is the frame of the image contained within the scrollview. This will scroll (zoom) the entire image to be visible within the scrollview.

0
votes

There is an example available in docs, TapToZoom, please look at it. Its a good example that will definitely answer you question.

To answer you question, like someone already we have to use

[scroller zoomToRect:zoomRect animated:YES];

where the zoomToRect is the rectangle where you want to zoom.

0
votes

I think you can also use

[yourScrollView setZoomScale:1.0 animated:YES];

for zoom out your image view and set it to normal zoom.