views:

197

answers:

1

Hi,

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 can any please help me.

Thank you

+2  A: 

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

Steve Streza