UITableViewCell 添加长按手势(别的手势类似)
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
}
}
本文标题:UITableViewCell 添加长按手势(别的手势类似)
本文链接:https://www.haomeiwen.com/subject/ikvbtxtx.html
网友评论