Question

In my app i want to drag a image any where in the view and want to resize the image by pinching,gestures.

I am able to drag the image any where by using - (void) touchesBeganNSSet*)touches withEventUIEvent*)event and - (void) touchesMovedNSSet*)touches withEventUIEvent*)event .

But am not able to resize the image.

Was it helpful?

Solution

The pinch-to-zoom behavior is given to you automatically by the UIScrollView class. Add one in place of your existing image view, then add your image view as a subview to the scroll view. Make sure the scroll view has a delegate.

The scroll view will call the delegate's viewForZoomingInScrollView: method. Make sure it returns your image view.

Then, just set the minimumZoomScale and maximumZoomScale, and the behavior should happen automatically.

HTH

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top