zoukankan      html  css  js  c++  java
  • iOS 左右滑动 手势 响应方法

    1.  

    @property (nonatomic, strong) UISwipeGestureRecognizer *leftSwipeGestureRecognizer;

    @property (nonatomic, strong) UISwipeGestureRecognizer *rightSwipeGestureRecognizer;

    2.  

    @synthesize leftSwipeGestureRecognizer,rightSwipeGestureRecognizer;

    3. 在视图控制器里加载这两个手势

       self.leftSwipeGestureRecognizer = [[UISwipeGestureRecognizer allocinitWithTarget:self action:@selector(handleSwipes:)];

       self.rightSwipeGestureRecognizer = [[UISwipeGestureRecognizer allocinitWithTarget:self action:@selector(handleSwipes:)];

       self.leftSwipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionLeft;

       self.rightSwipeGestureRecognizer.direction = UISwipeGestureRecognizerDirectionRight;

       [self.viewaddGestureRecognizer:self.leftSwipeGestureRecognizer]; 

       [self.viewaddGestureRecognizer:self.rightSwipeGestureRecognizer];

    4. 

    - (void)handleSwipes:(UISwipeGestureRecognizer *)sender

    {

        if (sender.direction == UISwipeGestureRecognizerDirectionLeft) {

        //添加要响应的方法

                }

            if (sender.direction == UISwipeGestureRecognizerDirectionRight) {

        //添加要响应的方法

               }

    }

     

  • 相关阅读:
    AAC音频格式分析与解码
    SIGPIPE信号
    可变参数的宏定义
    Makefile条件编译debug版和release版
    Linux下查看内存使用情况
    Trie树 字典树
    C/C++随机数生成 rand() srand()
    关于编译安装Thrift找不到libthriftnb.a的问题
    Linux下使用popen()执行shell命令
    WebSocket协议分析
  • 原文地址:https://www.cnblogs.com/someonelikeyou/p/3512268.html
Copyright © 2011-2022 走看看