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

  • 相关阅读:
    简单手风琴特效、轮播
    MVC
    文字自动下拉隐藏显示
    jQuery基础 DOM操作
    JQuery基础
    SQL 中的常用函数及使用
    数据库中的T-sql语句 条件修改 高级查询
    2017-03-09 数据库的基本东西
    C#中的冒泡排序
    C#中的数组
  • 原文地址:https://www.cnblogs.com/isItOk/p/5397942.html
Copyright © 2011-2022 走看看