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

  • 相关阅读:
    关于MySQL Server影响ASP.NET网站使用的问题:未能加载文件或程序集MySql.Web.v20
    关于DataGridViewComboBoxColumn的二三事
    我是如何准备高项的
    MyBatis接口式编程
    初识MyBatis之HelloWorld
    Java基础——值传递
    Java基础——接口和抽象类
    Java基础一
    POST和GET的区别
    Python浅拷贝和深拷贝
  • 原文地址:https://www.cnblogs.com/Cristen/p/2778801.html
Copyright © 2011-2022 走看看