子视图在非 1:1 缩放/滚动视图上出现手势识别问题
我有一个 UIScrollView,在上面我还创建了手势识别器。点击、双击、两根手指点击等。在滚动视图上,我创建了几个其他 UIView。将这些视图中的每一个视为 Drawing 对象。圆形、正方形、按钮、图像等。我可以平移、旋转、点击等每个子视图,并且它们在大多数情况下都可以工作。
如果缩放滚动视图不是 100% (1-1),则平移子视图会变得有点粗略。你总是可以点击它们来让它们突出显示,尽管平移、旋转等是不确定的。通常,如果我尝试平移选定的子视图,它会平移滚动视图。有时有效,有时无效。将缩放设置为 100%,或关闭滚动(将比例设置为相同的最小/最大),我可以执行预期的操作。
关于从哪里开始解决此问题有什么建议吗?
I have a UIScrollView that on it I have also created Gesture Recognizers. Tap, Double Tap, two finger tap, etc. On the Scroll View I create several other UIViews. Think of each of these views as Drawing objects. Circle, Squares, buttons, images, etc. Each of the Subviews I can pan, rotate, tap, etc and they all work for the most part.
If the Scaling Scroll View is not at 100% (1-1) then panning the subviews gets a bit sketchy. you can always tap them to get them to Highlight, though panning, rotation, etc is iffy. Typically if I try to pan a selected subview, it pans the scroll view. Sometimes it works, sometimes it does not. Set the zoom to 100%, or turn off the Scrolling (set scale to the same min/max), I can do what Is expected.
Any Suggestions on where to start troubleshooting this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
虽然不是 100% 有效,但这是使问题消失的代码。我必须对 UIScrollView 进行子类化,重写
(BOOL)touchesShouldCancelInContentView:(UIView *)view
,如果视图不是 UIScrollView 的UIView
类,则返回 NO。查看Not 100% why this works, but this is the code that made the issue disappear. I had to Subclass UIScrollView, override
(BOOL)touchesShouldCancelInContentView:(UIView *)view
and return NO if the view was anything but theUIView
class for theUIScrollView.View