触摸事件 (touchesMoved) 不适用于 UIScrollView 内的 UIViews [英] Touch events (touchesMoved) not working on UIViews inside UIScrollView

查看:27
本文介绍了触摸事件 (touchesMoved) 不适用于 UIScrollView 内的 UIViews的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 UIScrollView 中有一个 UIView,并且这些视图的 UIViewControllers 没有接收到触摸事件.如果我从滚动视图中取出视图,那么它就可以工作了.

I have a UIView inside a UIScrollView, and the UIViewControllers for those views are not receiving the touch events. If I take the views out of the scroll view then it works.

UserInteraction 是所有视图的默认开启,但它仍然不起作用!

UserInteraction is default ON of all views but it's still not working!

这一定是可能的,如果有人能指出我正确的方向,我将不胜感激!

This must be possible and I'd be really grateful if someone could point me in the right direction!

非常感谢,

推荐答案

将以下代码添加到实现文件中然后触摸移动

add the following code to implementation file then touches moved

 @interface UIScrollView(Custom)
    @end
    @implementation UIScrollView(Custom)

   -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    [super touchesMoved:touches withEvent:event];
}
    @end

这篇关于触摸事件 (touchesMoved) 不适用于 UIScrollView 内的 UIViews的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆