zoukankan      html  css  js  c++  java
  • UITableView的cell的点击

    虽然是tableview中cell的长按手势  但是手势是添加在tableview上的  

    UILongPressGestureRecognizer *longpress = [[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(pressAction:)];
    [self.tableView addGestureRecognizer:longpress];

    - (void)pressAction:(UILongPressGestureRecognizer *)longPressGesture
    {
    if (longPressGesture.state == UIGestureRecognizerStateBegan) {//手势开始
    CGPoint point = [longPressGesture locationInView:self.tableView];
    NSIndexPath *currentIndexPath = [self.tableView indexPathForRowAtPoint:point]; // 可以获取我们在哪个cell上长按
    NSLog(@"%ld",currentIndexPath.section);
    }
    if (longPressGesture.state == UIGestureRecognizerStateEnded)//手势结束
    {
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"是否删除" message:nil delegate:self cancelButtonTitle:@"确认" otherButtonTitles:@"取消", nil];

    [alert show];

    }
    }

    参考链接

    https://www.cnblogs.com/dujiahong/p/10676877.html

  • 相关阅读:
    form表单提交json格式数据
    docker搭建jenkins
    consul搭建服务注册和
    docker创建mysql镜像
    Swagger入门
    net coer log4+ELK搭建
    log4配置
    netcore autofac依赖注入
    netcore 跨域
    netcore 读取配置文件
  • 原文地址:https://www.cnblogs.com/isItOk/p/5397942.html
Copyright © 2011-2022 走看看