UIScrollView不能响应touch事件的解决办法
2016-01-07 09:13
573 查看
UIScrollView本身事是不支持touch的,我们可以给她添加拓展
#import "UIScrollView+util.h"
@implementation UIScrollView (util)
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[[self nextResponder] touchesBegan:touches withEvent:event];
[super touchesBegan:touches withEvent:event];
}
-(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[[self nextResponder] touchesMoved:touches withEvent:event];
[super touchesMoved:touches withEvent:event];
}
-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[[self nextResponder] touchesEnded:touches withEvent:event];
[super touchesEnded:touches withEvent:event];
}
@end
#import "UIScrollView+util.h"
@implementation UIScrollView (util)
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[[self nextResponder] touchesBegan:touches withEvent:event];
[super touchesBegan:touches withEvent:event];
}
-(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[[self nextResponder] touchesMoved:touches withEvent:event];
[super touchesMoved:touches withEvent:event];
}
-(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
[[self nextResponder] touchesEnded:touches withEvent:event];
[super touchesEnded:touches withEvent:event];
}
@end
相关文章推荐
- 详解iOS应用UI开发中的九宫格坐标计算与字典转换模型
- querySelector/querySelectorAll选择器两个容易忽略的点
- Arduino 串口的一些高级用法
- JSP自定义标签rtexprvalue属性用法实例分析
- 如何把UIView转成UIImage,解决模糊失真问题
- return关键词,break和continue
- Android UI组件进阶(2)——仿Windows对话框
- UITableView定义等高的cell
- Android UI组件进阶(1)——带进度条的按钮
- UITableView总结
- MQTT学习笔记——MQTT协议体验 Mosquitto安装和使用
- UIcollection基础
- The Citrix server is unable to process your reques
- UEFI + GPT模式安装Windows7
- Controller的三种创建方式
- sequence training
- 300. Longest Increasing Subsequence
- uiAutoMator 自动化测试创建步骤
- 【学习笔记】HBuilder状态栏隐藏显示及颜色
- LeetCode OJ:Implement Stack using Queues(队列实现栈)