zoukankan      html  css  js  c++  java
  • UIButton的长按事件 tableview

    //button的长按事件

        UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizeralloc] initWithTarget:selfaction:@selector(btnLong:)];

        //长按时间

        longPress.minimumPressDuration = 0.8;

        [button addGestureRecognizer:longPress];

    #pragma mark -
    #pragma mark Table Delegate Methods 
    - (NSInteger)tableView:(UITableView *)tableView 
    indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath

    表格:可以使内容的选择,现实两种动画效果

        cell.imageView.image = image;
        cell.imageView.highlightedImage = image2;

    表格:取消选中项的选择动画

     [tableView deselectRowAtIndexPath:indexPath animated:YES];

    //添加长按事件
     UILongPressGestureRecognizer *lpr = [[UILongPressGestureRecognizer alloc] 
                initWithTarget:self 
                action:@selector(LongPressEvent:)];
     lpr.minimumPressDuration = 0.8;
     [self addGestureRecognizer:lpr];
     [lpr release];

    截取长按事件:

    - (void)LongPressEvent:(UILongPressGestureRecognizer  *)gestureRecognizer{
     CGPoint p=[gestureRecognizer locationInView:listenView];
     NSIndexPath *indexpath=[listenView indexPathForRowAtPoint:p];
     if (indexpath==nil) {
      return;
     }
     self.editBookinfo = [filearray objectAtIndex:[indexpath row]];
    }

  • 相关阅读:
    C++学习之:括号匹配与栈的使用
    mooc网站以及学习资料收集
    android 获取字符串的方法
    androidStudio中如何加载字体资源?
    BluetoothGatt API
    Android 反编译工具简介
    BluetoothAdapter.LeScanCallback 参考文档
    openCV1
    Android客户端向服务器端发送数据的流程(1)
    将博客搬至CSDN
  • 原文地址:https://www.cnblogs.com/Cristen/p/2778801.html
Copyright © 2011-2022 走看看