iOS 如何实现图片双击放大, 捏合手势放大缩小
PHP中文网
PHP中文网 2017-04-17 16:12:07
0
2
656

ScrollView上面有一组UIImageView, 想要实现双击图片放大, 捏合手势放大 缩小的效果. 类似于Apple手机相册的效果. 请各位大神给出解决方案, 最好能有简单实现的代码!

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(2)
PHPzhong

Put ImageView inside ScrollView

Listen to the callback of ScrollView (delegation mode)
Implement the following method

- (nullable UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView;     
// return a view that will be scaled. if delegate returns nil, nothing happens
大家讲道理

1.

Double click on the picture to enlarge

You need to add a double-click gesture to UIIMageView yourself. In the gesture response method, just adjust the frame of ImageView.
2.

Zoom in or out via pinch gesture

, you can use the properties of scroview itself. At this time, you need to put uiiamgeView on a scrollView with the same width and height as imageView, and then add each scrollView to the large scrollView originally used to place iamgeView. For others, refer to Just download the <UIScrollViewDelegate> proxy method.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template