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

  • 相关阅读:
    sklearn linear_model,svm,tree,naive bayes,ensemble
    便利过滤
    js下载
    小程序修改radio的大小
    el-tree 问题与需求
    jsp页面用html引入vue.js注意问题
    WebPack
    yarn
    vue-cli 4以上 vue.config.js
    Cannot find module 'core-js/modules/es6.regexp.constructor'
  • 原文地址:https://www.cnblogs.com/Cristen/p/2778801.html
Copyright © 2011-2022 走看看