【发布时间】:2011-12-07 07:44:21
【问题描述】:
我在 uiscrollview 中有许多 uiimageviews。我正在尝试将 uiimageview 拖出 uiscrollview。我已经对 uiscollview 进行了子类化,并编写了 custon touchbegan、toucmoved 和 touchended 方法,以在滚动拖动事件上将触摸传递给滚动视图超类,并在滚动事件以外的事件上传递给我的主视图控制器类触摸方法。 要将 uiimageview 从 uiscrollview 中拖出,我将其从其 superview(scrollview) 中删除,并将其添加到 touchbegan 方法的 mainview 中。 我的 uiimageview 从滚动视图中删除并成功添加到主视图。 现在这里的问题是:在第一次触摸时,我的 touchbegan 方法被调用,但是当我移动 uiimageview 时没有调用 touchmoved 方法。 在第二次触摸之后一切正常 n uiimageview 被拖出滚动视图
更新:我继承了 UIImageView 类并在 uiimageview 子类中编写了 touchbegan、touchmoved 和 touchended 方法,现在它正在工作。以前我使用的是 mainview 的触摸方法,所以 touch-methods 也在考虑触摸 UIScollview 。但现在只考虑 uiimageviews。我还添加了一项更改:我在 touchbegan 禁用滚动并在 touchend 启用它。谢谢
【问题讨论】:
标签: iphone uiscrollview uiimageview drag