可以自己重写一个UITableView的子类,或者给TableView写一个类别,在其中写入以下几个方法
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[[self nextResponder] touchesBegan:touches withEvent:event];
[super touchesBegan:touches withEvent:event];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
[[self nextResponder] touchesEnded:touches withEvent:event];
[super touchesEnded:touches withEvent:event];}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
[[self nextResponder] touchesMoved:touches withEvent:event];
[super touchesMoved:touches withEvent:event];
}
然后在用到tableView的controller中就可以直接使用
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
方法了
浙公网安备 33010602011771号