zoukankan      html  css  js  c++  java
  • UIScrollView无法响应touch事件的解决方法

    用过UIScrollView的都会发现UIScrollView不会响应touch事件,这样就无法在touches相关的方法中做一些事情了,比如收回键盘等等。其实写个categroy就可以解决这个问题了。

    具体实现如下:

    @implementation UIScrollView (UITouchEvent)
    
    - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
        [[self nextResponder] touchesBegan:touches withEvent:event];
        [super touchesBegan:touches withEvent:event];
    }
    -(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
        [[self nextResponder] touchesMoved:touches withEvent:event];
        [super touchesMoved:touches withEvent:event];
    }
    
    - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
        [[self nextResponder] touchesEnded:touches withEvent:event];
        [super touchesEnded:touches withEvent:event];
    }
    
    @end

    备注:转自http://blog.csdn.net/volcan1987/article/details/6677370

  • 相关阅读:
    chmod命令
    ls命令
    数组值去重-小技巧
    使用redis接管session
    使用redis接管cookie
    redis操作封装类
    HTTP协议详解
    Linux网络编程--多播
    Live555 分析(三):客服端
    Live555 分析(二):服务端
  • 原文地址:https://www.cnblogs.com/haili/p/4112369.html
Copyright © 2011-2022 走看看