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
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.
Put ImageView inside ScrollView
Listen to the callback of ScrollView (delegation mode)
Implement the following method
1.
You need to add a double-click gesture to UIIMageView yourself. In the gesture response method, just adjust the frame of ImageView.
2.
, 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.