zoukankan      html  css  js  c++  java
  • 如何响应UIScrollView的touchesBegan和touchesEnd消息

    UIScrollView自己处理了这两个消息,但是并没有提供给UIScrollViewDelegate

    因为需要支持用户点击ScrollView,从而选择其中的内容,只好从UIScrollView派生出一个新的类ClickableScrollView

    重写touchesBegan和touchesEnd两个消息函数,转发出去

    代码如下:

    - (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
    {
        [super touchesBegan:touches withEvent:
    event];
        
    if ( !self.dragging )
        {
            [[self nextResponder] touchesBegan:touches withEvent:
    event];
        }
    }

    - (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event
    {
        [super touchesEnded:touches withEvent:
    event];
        
    if ( !self.dragging )
        {
            [[self nextResponder] touchesEnded:touches withEvent:
    event];
        }
    }
  • 相关阅读:
    板子们~缓慢更新
    Hello World!
    [SHOI2008]堵塞的交通traffic
    [JSOI2008]最大数
    [SCOI2005]扫雷
    [HAOI2007]上升序列
    [HAOI2007]理想的正方形
    [SCOI2003]字符串折叠
    [HAOI2008]移动玩具
    [BJOI2006]狼抓兔子
  • 原文地址:https://www.cnblogs.com/hyamw/p/2139388.html
Copyright © 2011-2022 走看看