长按手势获取UITableView的indexPath值,删除某行
来源:互联网 发布:打字员软件 编辑:程序博客网 时间:2024/06/05 13:24
- (void)viewDidLoad
{
//给cell加长按手势
UILongPressGestureRecognizer *gestureLongPress = [[UILongPressGestureRecognizeralloc]initWithTarget:selfaction:@selector(gestureLongPress:)];
gestureLongPress.minimumPressDuration =1;
[self.tableV0addGestureRecognizer:gestureLongPress];
[gestureLongPressrelease];
}
#pragma mark - 长按手势
- (void)gestureLongPress:(UILongPressGestureRecognizer *)gestureRecognizer
{
CGPoint tmpPointTouch = [gestureRecognizerlocationInView:self.tableV0];
if (gestureRecognizer.state ==UIGestureRecognizerStateBegan) {
NSIndexPath *indexPath = [self.tableV0indexPathForRowAtPoint:tmpPointTouch];
if (indexPath ==nil) {
NSLog(@"not tableView");
}else{
focusSection = [indexPathsection];
focusRow = [indexPathrow];
NSLog(@"%d",focusSection);
NSLog(@"%d",focusRow);
deletebtn.hidden =NO;
}
}
}
//删除
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:focusRow inSection:focusSection];
[self.tableV0 deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
- 长按手势获取UITableView的indexPath值,删除某行
- 长按手势获取UITableView的indexPath值,删除某行
- UITableView获取cell的indexPath
- UITableView获取cell的indexPath
- UITableView获取cell的indexPath.row值(多种方式)
- 通过cell中的元素获取cell的indexPath以及长按tableview获取选中cell的indexPath
- UITableView长按手势UILongPressGestureRecognizer
- UITableView长按手势UILongPressGestureRecognizer
- 长按手势删除tableView选中的行
- UITableView 添加长按手势UILongPressGestureRecognizer
- 获取长按手势所点击的cell的行号
- UITableView,根据indexPath设置cell的编辑样式,删除cell ,增加cell &搜索条
- 根据indexPath拿到UITableView的cell
- UITableView获取cell的row值(解决自定义cell里的button通过点击无法获得cell的indexpath的问题)
- UITableView获取cell的row值(解决自定义cell里的button通过点击无法获得cell的indexpath的问题
- UITableView获取cell的row值(解决自定义cell里的button通过点击无法获得cell的indexpath的问题)
- tableView的indexPath值错误导致删除崩溃
- UITableView 的长按事件
- NSString
- 贪心 CF 333B Chips
- 最小值堆-Java实现
- Ubuntu下配置JDK
- android接触--新版本编译OK,系统却起不来
- 长按手势获取UITableView的indexPath值,删除某行
- linux下安装配置R环境相关依赖包
- HDU 1257 最少拦截系统
- 25个增强iOS应用程序性能的提示和技巧--中级篇
- 查找窗口的几种方法
- uva 10494 大数
- NSObject和反射
- VLC播放器所需的SPS,PPS获取方法
- Oracle 转义HTML特殊字符