cell.contentView.tag= indexPath.row;
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longTapAction:)];
longPress.minimumPressDuration = 0.8; //定义按的时间
longPress.numberOfTouchesRequired = 1;
longPress.view.tag= indexPath.row;
[cell.contentView addGestureRecognizer:longPress];
- (void) longTapAction:(UILongPressGestureRecognizer*)longPress {
NSLog(@"%ld>>>>>>>>>tag",(long)longPress.view.tag);
if (longPress.state == UIGestureRecognizerStateBegan) {
NSLog(@"long pressTap state :begin执行2次");
[self promptIfTheMessageDeleted:longPress.view.tag];
}else{
NSLog(@"long pressTap state :end执行1次");//
}
}
网友评论