iOS UITableView UIScrollView 的支持触摸事件
2015-08-13 15:17
417 查看
在使用了 UITableView 或UIScrollView的controller 里无法响应触摸事件touch事件, 自定义tableView、scrollView
#import <UIKit/UIKit.h> @interface touchScrollView : UIScrollView @end
#import "touchScrollView.h" @implementation touchScrollView - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) { // Initialization code } return self; } -(void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ [super touchesBegan:touches withEvent:event]; if ( !self.dragging ) { [[self nextResponder] touchesBegan:touches withEvent:event]; } } -(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ [super touchesEnded:touches withEvent:event]; if ( !self.dragging ) { [[self nextResponder] touchesEnded:touches withEvent:event]; } } -(void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesEnded:touches withEvent:event]; if(!self.dragging) { [[self nextResponder] touchesCancelled:touches withEvent:event]; } } -(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { [super touchesMoved:touches withEvent:event]; if(!self.dragging) { [[self nextResponder] touchesMoved:touches withEvent:event]; } }
相关文章推荐
- Bluetooth Core specification 4.2 主要更新
- mysql 慢日志分析工具pt-query-digest
- easyui导入文件的顺序
- VS2013 “未找到与约束 ContractName Microsoft.Internal.VisualStudio.PlatformUI.ISolutionAttachedCollectionService RequiredTypeIdentity Microsoft.Internal.VisualStudio.PlatformUI.ISolutionAttachedCollectionService 匹配的导出”
- poj-1458-Common Subsequence(LCS)
- 简单的Queue
- EasyUI combobox下拉列表框--下拉列表框的onShowPanel事件
- NSURLRequest的官方文档
- UI中的Block传值
- Spark GraphX Programming Guide 编程指南
- 修改fiddler中CustomRules.js的Request或Response
- entityManager来主键查找类和entityManager.createQuery的区别
- 解题报告 之 HDU5288 OO' s Sequence
- easy ui datagrid的高度自适应
- EasyUI combotree树形下拉框--判断树形下拉框对象是否为空
- 浅谈tableView内存优化行高问题
- UIViewAutoresizing
- [iOS]UITableViewController 无法实现键盘自动适配
- Arduino ESP8266 做Station模式连接路由器&服务器。基础模型
- iOS中storyboard故事板使用Segue跳转界面、传值