touchesBegan: withEvent: 不执行解决
来源:互联网 发布:低学历 知乎 编辑:程序博客网 时间:2024/05/22 12:47
touchesBegan: withEvent: / touchesMoved: withEvent: / touchesEnded: withEvent: 等只能被UIView捕获(如有问题请指出对请指出,路过的大牛请勿喷),当我们创建
UIScrollView 或 UIImageView时,当点击时UIScrollView 或 UIImageView 会截获touch事件,导致touchesBegan: withEvent:/touchesMoved: withEvent:/touchesEnded: withEvent: 等方法不执行。解决办法:当UIScrollView 或 UIImageView 截获touch事件后,让其传递下去即可(就是传递给其父视图UIView)
可以通过写UIScrollView 或 UIImageView 的category 重写touchesBegan: withEvent: / touchesMoved: withEvent: / touchesEnded: withEvent: 等来实现
//// UIScrollView+UITouch.m// //// Created by MLS on 15/11/20.// Copyright © 2015年 mls. All rights reserved.//#import "UIScrollView+UITouch.h"@implementation UIScrollView (UITouch)- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ // 选其一即可 [super touchesBegan:touches withEvent:event];// [[self nextResponder] touchesBegan:touches withEvent:event];}@end
0 0
- touchesBegan: withEvent: 不执行解决
- touchesBegan: withEvent: 不执行/完美收起键盘
- touchesBegan等方法不执行
- touchesBegan:(NSSet*)touches withEvent:(UIEvent *)event使用
- touchesBegan: withEvent:触摸事件传递顺序
- 在UITableviewController中touchesBegan:withEvent:无响应问题
- crontab不执行的解决。
- 关于使用UIPanGestureRecognizer手势touchesBegan不调用的问题
- 解决cron不执行的问题
- 解决cron不执行的问题
- 解决cron不执行的问题
- 解决OnFling失效\不执行的问题
- 解决android锁屏后service不执行
- 解决onActivityResult方法不执行的办法
- Spring定时任务不执行的解决
- 解决/etc/rc.local启动不执行
- ioctl调用不执行问题的解决
- 解决onActivityResult方法不执行的办法
- Android打开MyEclipse报错:发现了以元素 'd:skin' 开头的无效内容。此处不应含有子元素。
- [最优化算法]最速下降法求解无约束最优化问题
- sql常用
- iOS应用性能调优的25个建议和技巧
- 简单 Goroutine 池实现
- touchesBegan: withEvent: 不执行解决
- 实习整理(十一)
- 一直以来伴随我的一些学习习惯(四):知识结构
- Samba服务器的安装与配置
- 做程序员有什么好处
- 使用.a文件遇到的错误
- Android开发中如何避免 Out Of Memory(OOM) ?
- Oracle存在修改,不存在插入记录 SQL
- 动态规划:最长公共子序列问题