简体   繁体   English

UIScrollview子视图在缩放后无法识别平移手势

[英]UIScrollview subviews not recognizing pan gesture after zooming

I have a scrollview to which I have added an image view as a subview. 我有一个滚动视图,在其中已将图像视图添加为子视图。 The contentsize of the scrollview is same as the size of the imageview (width and height). 滚动视图的contentsize与图像视图的大小(宽度和高度)相同。 There are two buttons outside the scrollview. 滚动视图外有两个按钮。 When I click on either on them, a small rectangle view is added as a subview to the imageview. 当我在它们上单击时,一个小的矩形视图将作为子视图添加到imageview。 This rectangle view can be dragged anywhere on the imageview by the user after it has been added. 添加矩形视图后,用户可以将其拖动到图像视图上的任何位置。

This works fine until I pinch to zoom the scrollview. 直到我捏放大scrollview之前,它都可以正常工作。 In the viewForZoomingInScrollView: method, I return the imageview and the zooming works fine. 在viewForZoomingInScrollView:方法中,我返回了imageview并且缩放正常。 But in the zoomed view when I try to drag around the rectangle view, it does not move. 但是在缩放视图中,当我尝试在矩形视图周围拖动时,它不会移动。 It does not recognize the pan gestures any more. 它不再识别平移手势。 Any idea why this is happening? 知道为什么会这样吗?

This Dragable view is too small and I have to change its position so I am zomming scrollview to touchable view. 此可拖动视图太小,我必须更改其位置,因此我将滚动视图放大为可触摸视图。

我认为您应该执行以下操作:缩放完成时,通过calling:scrollViewDidEndZooming:withView:atScale:以下方法通知委托calling:scrollViewDidEndZooming:withView:atScale:在此方法中,您将更新矩形可以移动或可能是其他calling:scrollViewDidEndZooming:withView:atScale:的视图的父视图。但是您必须使用此方法进行更新。...请把您的特定代码放在问题所在的位置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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