- UILongPressGestureRecognizer *lpgr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)];
- lpgr.minimumPressDuration = 1.0;
- lpgr.delegate = self;
- [mTableView addGestureRecognizer:lpgr];
- [lpgr release];
-
- -(void)handleLongPress:(UILongPressGestureRecognizer *)gestureRecognizer
- {
- CGPoint p = [gestureRecognizer locationInView:mTableView ];
-
-
-
- NSIndexPath *indexPath = [mTableview indexPathForRowAtPoint:p];
- if (indexPath == nil)
- NSLog(@"long press on table view but not on a row");
- else
- NSLog(@"long press on table view at row %d", indexPath.row);
-
- }
posted @
2015-11-09 10:15
CodingMann
阅读(
1022)
评论()
编辑
收藏
举报