我子类的UITableView(如KRTableView),并实施了四个基于触摸的方法(的touchesBegan,touchesEnded,touchesMoved,并touchesCancelled),以便当正在上一个UITableView处理的基于触摸的事件我能察觉。 从本质上讲,当UITableView的是向上或向下滚动什么,我需要检测的。
然而,子类的UITableView和创建上述方法滚动或手指移动被一个UITableViewCell内存在的,而不是对整个的UITableView当仅检测。
只要我的手指移动到下一个单元格,触摸事件不做任何事情。
这就是我如何继承的UITableView:
#import "KRTableView.h"
@implementation KRTableView
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesBegan:touches withEvent:event];
NSLog(@"touches began...");
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesMoved:touches withEvent:event];
NSLog(@"touchesMoved occured");
}
- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent *)event {
[super touchesCancelled:touches withEvent:event];
NSLog(@"touchesCancelled occured");
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesEnded:touches withEvent:event];
NSLog(@"A tap was detected on KRTableView");
}
@end
我怎么能当UITableView的是或滚动上下检测?