Vishal Mali
Vishal Mali

Reputation:

UIScrollView for zooming an image

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.

Upvotes: 1

Views: 1938

Answers (3)

Yuvrajsinh
Yuvrajsinh

Reputation: 4584

I think you can also use

[yourScrollView setZoomScale:1.0 animated:YES];

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

Upvotes: 0

anotherCoder
anotherCoder

Reputation: 732

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.

Upvotes: 0

Tim
Tim

Reputation: 60150

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.

Upvotes: 2

Related Questions