关于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类型 ...
随机推荐
- LeetCode contest-95[876,877,👁878]
876. Middle of the Linked List first submission # Definition for singly-linked list. # class ListNod ...
- python自带的进程池及线程池
进程池 """ python自带的进程池 """ from multiprocessing import Pool from time im ...
- 批量移动AD用户到指定OU
原文链接:http://blog.51cto.com/shubao/1346469 作为域管理员,在日常工作中使用ADUC(AD用户和计算机)工具在图形界面中进行账号管理操作可谓是家常便饭了.然而一个 ...
- Linux shell : 管道 |
概念 意义 理解 用法 返回值 PIPESTATUS An array variable (see Arrays) containing a list of exit status values fr ...
- [leetcode]86. Partition List划分链表
Given a linked list and a value x, partition it such that all nodes less than x come before nodes gr ...
- php进程(线程)通信基础--System V共享内存
PHP默认情况没有开启功能,要支持该功能在编译PHP的时候要加入下面几个选项 System V消息,--enable-sysvmsg System V信号量支持,--enable-sysvsem ...
- 设置angular公共样式表
一.现象 新创建的项目,是直接显示在src目录下的,假如会用到其它第三方的全局样式时,不能统一放在一个地方统一来管理,就会感觉有点乱. 二.解决 1.移动样式表. 在assets文件夹(该文件夹一般都 ...
- jquery.validate.js的简单示例
一.官方资料 官网 github 二.html <!DOCTYPE html> <html> <head> <meta charset="utf-8 ...
- Spring 系列目录
Spring(https://spring.io/) 系列目录 第一篇:Spring 系列 第一章 Spring Core (1) Convert 1.1.1 Spring ConversionSer ...
- UVA 2451 Brackets sequence
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=9 ...