可以自己重写一个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

 方法了

posted on 2017-02-24 17:54  食肉动物  阅读(588)  评论(0)    收藏  举报