zoukankan      html  css  js  c++  java
  • 手势互斥

    1.如果一个视图添加了好几个手势

    //拖拽手势

    UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(playerPan:)];

    [m_touchView addGestureRecognizer:pan];

    //单击手势

    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(playertap:)];

     [m_touchView addGestureRecognizer:tap];

    //手势互斥

    [tap requireGestureRecognizerToFail:pan];

    为了防止一个视图添加了多种手势产生冲突

    2.在AppDelegate中添加 [[UIButton appearance] setExclusiveTouch:YES];

    这个也是相当于手势互斥,一个界面上面只有一个控件接受点击事件

    上面的做法是省事的做法,也可以单独设置某个button的点击互斥事件

  • 相关阅读:
    list tuple dict 方法
    字典的方法
    看不懂的缩写
    canvas画图
    DOM2和DOM3
    表单脚本
    事件
    DOM扩展
    DOM
    BOM
  • 原文地址:https://www.cnblogs.com/chaoyueME/p/6247671.html
Copyright © 2011-2022 走看看