UIScrollView不能响应touch事件的解决办法
2016-05-12 16:44
609 查看
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
相关文章推荐
- UIView -&gt; image &amp; 本地时间获取
- UILabel数字变化增加动画
- emwin GUI自带的定时器无法进入的解决方案
- UITextField-修改占位文字和光标的颜色,大小
- UIFont 字体设置
- UITextView实现PlaceHolder的方式
- leetcode increasing-triplet-subsequence
- poj-1679 The Unique MST(次小生成树模板)
- 解决Duilib开源库中字符&被解析成下划线的问题
- ios状态栏UIStatusBar
- iOS UIView setNeedsDisplay和setNeedsLayout
- String和StringBuilder的区别
- UIDocumentInteractionController 的使用
- IOS和安卓ui设计常用尺寸及基本知识
- uitabbaritem image 动态修改问题runtime
- StringBuffer与StringBuilder的比较
- 交互设计的根本是用户体验
- 为啥UI设计师要学习产品思维?
- 移动应用UI规范
- NetMQ(二): 请求响应模式 Request-Reply