简体   繁体   中英

How to zoom image in iPhone?

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 how to do this???

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).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM