原因是:UIViewtouch事件被UIScrollView捕获了。

解决办法:让UIScrollView将事件传递过去。于是最简单的解决办法就是加一个UIScrollViewcategory。这样每个用到UIScrollView的地方只要导入这个category就可以直接响应相关的touch事件了。

类似问题:在论坛看见很多人说UIImageView也没办法响应,不过我想解决办法和原因都是一样的。

#import "UIScrollView+UITouch.h"

@implementation UIScrollView (UITouch)

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

关于UIScrollView不能响应UITouch事件的解决办法的更多相关文章

  1. UIScrollView不能响应touch事件的解决办法

    UIScrollView本身事是不支持touch的,我们可以给她添加拓展 #import "UIScrollView+util.h" @implementation UIScrol ...

  2. 调测Onvif事件总结解决办法

    主要在调测事件用例的过程中,发现了大量的信息,和未曾碰到的场景和非法错误等信息,先总结解决办法如下: (1)测试过程中发现以前的一个难题解决了,原先在生成soap空间命名的文件中有部分需要下载,离线生 ...

  3. FileSystemWatcher触发多次Change事件的解决办法 .

    最近要用到FileSystemWatcher来监控某个目录中的文件是否发生改变,如果改变就执行相应的操作.但在开发过程中,发现FileSystemWatcher在文件创建或修改后,会触发多个Creat ...

  4. append()方法生成的元素绑定的事件失效解决办法

    我使用append()方法动态生成的a链接的click事件没有起效果,查找了资料,了解到,我使用的onclick方法绑定的事件对动态生成的元素是无效的,解决办法如下: 使用事件委托,并且要用on来绑定 ...

  5. input输入框file类型第二次不触发onchange事件的解决办法,简单有效

    在网上看了很多办法,现在将网上大部分说法总结如下: 网上说法: 原因:选择一次后onchange事件没有绑定到input标签上:    解决办法:拷贝一份input标签的副本,每次选择后对原input ...

  6. ToolStrip控件在窗体没有焦点的情况下,需要单击二次才能够激发事件的解决办法

    protected override void WndProc(ref Message m) { if (m.Msg == 0x210) { Control control = Control.Fro ...

  7. android 使用动画 Button移动后不响应点击事件的解决办法

    animation3.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimatio ...

  8. img的onerror事件(瑕疵+解决办法)【转】

    显示图片的时候,为了更好的用户体验,可能会把一些没有图片的内容也用图片样式显示出来,此时我们就要用到IMG的onerror事件了,注意MyEclipse的快捷键alt+/是没有的. < img ...

  9. input[file]标签的accept=”image/*”属性响应很慢的解决办法

    转自:http://blog.csdn.net/lx583274568/article/details/52983693 input[file]标签的accept属性可用于指定上传文件的 MIME类型 ...

随机推荐

  1. !!代码:baidu地图

    http://map.baidu.com/mobile/  手机开发时,嵌入地图可以嵌入这个网址!! http://developer.baidu.com/map/lbs-cloud.htm 百度地图 ...

  2. Webform(条件查询)

    <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> &l ...

  3. leetcode438

    public class Solution {;public IList<int> FindAnagrams(string s, string p) { List<int> l ...

  4. T-SQL中的APPLY用法

    原文出处:http://www.sqlservercentral.com/articles/Stairway+Series/121318/ 从SQL Server 2005开始,微软添加了一个新的运算 ...

  5. 合批只是对CPU的优化,与GPU没有任何关系

    如题. 今天细想了下合批这个东西. 合批是节省了CPU的相关准备工作的工作量. 合批后,经过VS,PS,尝试测试,模板测试后,此时已没有了纹理,顶点,索引的概念,只剩下一个个孤立的像素,各像素间没有任 ...

  6. lastIndexOf() 找出指定元素出现的所有位置(返回的是下标数组)---lastIndexOf() 这个方法是倒叙查找,正序的是indexOf()

    var indices = []; var array = ['a', 'b', 'a', 'c', 'a', 'd']; var element = 'a'; var idx = array.las ...

  7. 【原】The Linux Command Line - Processes

    ps - report a snapshot of current processes top - display tasks job - list active jobs bg - place a ...

  8. 修改tomcat的编码方式,可以解决某些get请求乱码问题

    在tomcat/conf/server.xml配置文件添加如下,修改tomcat的编码方式 <Connector URIEncoding="utf-8" connection ...

  9. Sentinel统计线程,QPS,RT的方式

    一.Sentinel是阿里开源产品,用于流量监控和管理. 二.对于流量控制,可以通过限制线程数和QPS实现限流 1. 资源进入Sentinel的方式 Entry entry = null; try { ...

  10. 深入浅出PF 学习笔记---通过资源文件设置按钮的Style及通过x:null设置不受Style影响

    <Window x:Class="WpfStudy2018.StyleButton" xmlns="http://schemas.microsoft.com/win ...