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]];
    }

  • 相关阅读:
    apt-get install jdk
    progit-zh(Git中文文档)
    indexedDB bootstrap angularjs 前端 MVC Demo
    状态模式
    使用TypeConverter类
    wpf 全局异常捕获处理
    WPF 中的形状和基本绘图概述
    WPF设计自定义控件
    WPF快速入门系列(9)——WPF任务管理工具实现
    WPF快速入门系列(8)——MVVM快速入门
  • 原文地址:https://www.cnblogs.com/Cristen/p/2778801.html
Copyright © 2011-2022 走看看