未调用带有 touchesMoved 的 UIScrollView

UIScrollView with touchesMoved not called(未调用带有 touchesMoved 的 UIScrollView)
本文介绍了未调用带有 touchesMoved 的 UIScrollView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我有一个包含 UIImageView 的 UIScrollView.UIScrollView 允许缩放和平移 UIImageView.

I've a UIScrollView that contains an UIImageView. The UIScrollView lets zooming and panning through the UIImageView.

问题是我每次都想知道手指的移动,我试图用 touchesMoved 方法捕捉事件.但它不起作用,尽管正确调用了 touchesBegan 和 touchesEnded.

The problem is that I would like know the finger movement every time, and I'm trying to catch the event with touchesMoved method. But it's not working, despite touchesBegan and touchesEnded that are called correctly.

实际上,如果手指移动非常小,并且 UIScrollView 没有开始平移,就会调用 touchesMoved.在 UIScrollView 开始移动的那一刻,事件停止被调用.

In fact, touchesMoved is called if the finger movement is really small, and the UIScrollView doesn't started panning. At the moment that UIScrollView starts getting moved, the event stops being called.

有人知道问题出在哪里以及如何解决吗?我想也许里面的 UIImageView 正在捕捉事件或类似的东西.

Somebody know what's the problem and how to fix it? I've thought that maybe the UIImageView inside is catching the event or something like that.

推荐答案

滚动视图属性 canCancelContentTouches = NO 允许将触摸事件向上传递到响应者链.

The scrollview property canCancelContentTouches = NO allows the touch events to be passed up the responder chain.

这篇关于未调用带有 touchesMoved 的 UIScrollView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

UIButtons at the bottom of UIScrollView not working(UIScrollView 底部的 UIButtons 不起作用)
scrollViewWillEndDragging:withVelocity:targetContentOffset: not working on the edges of a UISCrollView(scrollViewWillEndDragging:withVelocity:targetContentOffset: 不在 UISCrollView 的边缘工作)
ImageView Scaling when scrolling down(向下滚动时 ImageView 缩放)
Bounds automatically changes on UIScrollView with content insets(UIScrollView 上的边界自动更改,带有内容插图)
iOS5 UITapRecognizer for UIScrollView interfering with buttons. How to fix?(用于 UIScrollView 的 iOS5 UITapRecognizer 干扰按钮.怎么修?)
Handling scroll views with (custom, interactive) view controller presentation and dismissal(使用(自定义、交互式)视图控制器呈现和解除处理滚动视图)