zoukankan      html  css  js  c++  java
  • iOS 长按事件 UILongPressGestureRecognizer

    //像这种控件的长按事件有些地方是有系统自带的。但有些时候用起来也不太方便。下面这个可能以后能用到
    UILongPressGestureRecognizer *longPressReger = [[UILongPressGestureRecognizer alloc]
                                                            
                                                            initWithTarget:self action:@selector(handleLongPress:)];
            
            longPressReger.minimumPressDuration = 2.0;
            
            [tbv addGestureRecognizer:longPressReger];
            
            [longPressReger release];
    
    
    -(void)handleLongPress:(UILongPressGestureRecognizer *)gestureRecognizer
    {
        NSLog(@"wwwwwfffffff");
        CGPoint point = [gestureRecognizer locationInView:tbv];
        if(gestureRecognizer.state == UIGestureRecognizerStateBegan)
            
        {
            NSLog(@"ssseeeeee");
        }
        
        else if(gestureRecognizer.state == UIGestureRecognizerStateEnded)
            
        {
            NSLog(@"mimimimimimi");
        }
        
        else if(gestureRecognizer.state == UIGestureRecognizerStateChanged)
            
        {
            NSLog(@"lostllllllll");
            
        }
        
        NSIndexPath *indexPath = [tbv indexPathForRowAtPoint:point];
        
        if (indexPath == nil)
        {
            NSLog(@"sadfasdfasdf");
        }
        else
        {
            
            //focusRow = [indexPath row];
            
            //focusView.hidden = NO;
            
        }
        
    }
  • 相关阅读:
    2. 开关电源.电感
    1. 开关电源.引子
    资源介绍
    3. EMC EMS EMI
    2. 基于MCU应用的EMC指南
    1. 内部管脚电路
    9.150 Predefined macros
    海康安防平台
    Redis常见配置
    利用python检测单词的相似度
  • 原文地址:https://www.cnblogs.com/qingjoin/p/2747710.html
Copyright © 2011-2022 走看看