I have subclassed UITableView (as KRTableView) and implemented four touch methods (touchsBegan, touchsEnded, touchhesMoved and touchsCancelled) so that I can detect when a touch event is being processed in a UITableView. Essentially, I need to detect when a UITableView scrolls up or down.
However, subclassing UITableView and creating the above methods only detects when scrolling or moving fingers in the UITableViewCell, and not in the entire UITableView.
As soon as my finger moves to the next cell, touch events do nothing.
This is how I subclass 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
How can I detect when a UITableView scrolls up or down?
objective-c iphone cocoa-touch uitableview
Kishyr Ramdial Oct 19 '09 at 9:59 2009-10-19 09:59
source share