关于UIScrollView不能响应UITouch事件的解决办法
原因是:UIView
的touch
事件被UIScrollView
捕获了。
解决办法:让UIScrollView
将事件传递过去。于是最简单的解决办法就是加一个UIScrollView
的category
。这样每个用到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事件的解决办法的更多相关文章
- UIScrollView不能响应touch事件的解决办法
UIScrollView本身事是不支持touch的,我们可以给她添加拓展 #import "UIScrollView+util.h" @implementation UIScrol ...
- 调测Onvif事件总结解决办法
主要在调测事件用例的过程中,发现了大量的信息,和未曾碰到的场景和非法错误等信息,先总结解决办法如下: (1)测试过程中发现以前的一个难题解决了,原先在生成soap空间命名的文件中有部分需要下载,离线生 ...
- FileSystemWatcher触发多次Change事件的解决办法 .
最近要用到FileSystemWatcher来监控某个目录中的文件是否发生改变,如果改变就执行相应的操作.但在开发过程中,发现FileSystemWatcher在文件创建或修改后,会触发多个Creat ...
- append()方法生成的元素绑定的事件失效解决办法
我使用append()方法动态生成的a链接的click事件没有起效果,查找了资料,了解到,我使用的onclick方法绑定的事件对动态生成的元素是无效的,解决办法如下: 使用事件委托,并且要用on来绑定 ...
- input输入框file类型第二次不触发onchange事件的解决办法,简单有效
在网上看了很多办法,现在将网上大部分说法总结如下: 网上说法: 原因:选择一次后onchange事件没有绑定到input标签上: 解决办法:拷贝一份input标签的副本,每次选择后对原input ...
- ToolStrip控件在窗体没有焦点的情况下,需要单击二次才能够激发事件的解决办法
protected override void WndProc(ref Message m) { if (m.Msg == 0x210) { Control control = Control.Fro ...
- android 使用动画 Button移动后不响应点击事件的解决办法
animation3.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimatio ...
- img的onerror事件(瑕疵+解决办法)【转】
显示图片的时候,为了更好的用户体验,可能会把一些没有图片的内容也用图片样式显示出来,此时我们就要用到IMG的onerror事件了,注意MyEclipse的快捷键alt+/是没有的. < img ...
- input[file]标签的accept=”image/*”属性响应很慢的解决办法
转自:http://blog.csdn.net/lx583274568/article/details/52983693 input[file]标签的accept属性可用于指定上传文件的 MIME类型 ...
随机推荐
- 图灵一代接入V1
现在官方没有一代接入了,但是还是可用,留个方法 $.ajax({ type:"post", url:"http://www.tuling123.com/openapi/a ...
- ASCS HA
Please let us know what do you mean by "the PAS can not be accessed", what error did you f ...
- Sql Server数据库之流程定义变量和流程控制语句
一.局部变量和全局变量 1.声明局部变量 语法:declare @变量名 变量类型 2.给局部变量赋值 语法:set @变量名=值, select @变量名=值 区别:第一种方式用于普 ...
- Could not find a package,configuration file provided by "G2O" ,G2OConfig.cmake,g2o-config.cmake
因为项目需要使用到g2o,所以自己从git上面clone下来, git clone https://github.com/RainerKuemmerle/g2o.git 然后: cd g2o mkdi ...
- jquery即时获取上传文件input file文件名
截图: 代码: <input type="file" id="choosefile" style="display:none"/& ...
- spark快速开发之scala基础之5高阶函数,偏函数,闭包
高阶函数 高阶函数就是将函数作为参数或者返回值的函数. object function { def main(args: Array[String]): Unit = { println(test(f ...
- android 无法import
参考 https://blog.csdn.net/u012489412/article/details/72784095 File - Invalidate Caches/Restart
- wampserver安装
WampServer的下载地址:https://sourceforge.net/projects/wampserver 安装教程:https://jingyan.baidu.com/article/4 ...
- 大数据学习笔记2 - 分布式文件系统HDFS(待续)
分布式文件系统结构 分布式文件系统是一种通过网络实现文件在多台主机上进行分布式存储的文件系统,采用C/S模式实现文件系统数据访问,目前广泛应用的分布式文件系统主要包括GFS和HDFS,后者是前者的开源 ...
- CentOS7双网卡绑定配置
step1:创建绑定文件 [root@node-1 ~]# vi /etc/sysconfig/network-scripts/ifcfg-bond0 TYPE="bond"BOO ...