zoukankan      html  css  js  c++  java
  • UIScrollView 与 touchesBegan 冲突解决方法

    给UIScrollView写一个延展 

    .h文件实现:

    @interface UIScrollView (NSFoundation)

    @end

    .m文件实现

    @implementation UIScrollView (ScrollTouch)

    //重写touchesBegin方法   

    -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{

    //主要代码实现:

        [[self nextResponder] touchesBegan:touches withEvent:event];

    //super调用,别漏

        [super touchesBegan:touches withEvent:event];

    }

     

    //重写touchesEnded方法   

    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

    [[self nextResponder] touchesEnded:touches withEvent:event];

    [super touchesEnded:touches withEvent:event];

    }

     

    //重写touchesMoved方法   

    -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

    [[self nextResponder] touchesMoved:touches withEvent:event];

    [super touchesMoved:touches withEvent:event];

    }

     

     

     

    @end

     

     

     

  • 相关阅读:
    mysql 主从配置 读写分离
    interface接口
    http结构
    call_user_func函数
    pcntl_fork 进程
    数据库事务
    php 之 ob缓冲
    shell脚本
    php 守护进程
    ssdb zset
  • 原文地址:https://www.cnblogs.com/slc-lover/p/5861617.html
Copyright © 2011-2022 走看看