UITableViewCell 添加长按手势(别的手势类似)
2017-05-09 本文已影响0人
LeeLeCoder
UILongPressGestureRecognizer *longPressGR = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressAction:)];
[_tableView addGestureRecognizer:longPressGR];
- (void)longPressAction:(UILongPressGestureRecognizer *)longPressGR
{
if (longPressGR.state == UIGestureRecognizerStateBegan) {
CGPoint point = [longPressGR locationInView:_tableView];
NSIndexPath *indexPath = [_tableView indexPathForRowAtPoint:point];
NPTaskCell *cell = [_tableView cellForRowAtIndexPath:indexPath];
// do some thing in here
}
}