I need to zoom an image in iphone...while the user double clicks on the image it will be zoomed in and on the next click it will be zoomed out....Can anybody direct me to ho
You would probably have to use the size
property of UIImage
, triggered by UIImageView
's touchesBegan
method.
You can also use animations if you want the zoom effect to be smooth.
Another option could be to place your UIImageView
inside a UIScrollView
, or use a UIWebView
.
Also, I suggest you take a look at the Three20 project. I think TTPhotoView
supports zooming.
If you want to zoom and scroll your view, you need a UIScrollView. Tricking it to do what you want used to be very hard, however the problem of programmatic zooming of UIScrollView is now solved.
I have a described how to do it, created ZoomScrollView class (a drop-in subclass of UIScrollView) to encapsulate the solution and provided a working example at github.com/andreyvit/ScrollingMadness/ (the README contains a long description of two UIScrollView tricks and the reasoning behind them).