How to zoom image in iPhone?

后端 未结 2 424
忘掉有多难
忘掉有多难 2021-01-06 12:51

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

相关标签:
2条回答
  • 2021-01-06 13:38

    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.

    0 讨论(0)
  • 2021-01-06 13:47

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

    0 讨论(0)
提交回复
热议问题