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];
        }
    }
  • 相关阅读:
    python实训day8
    python实训day7
    python实训day6
    python实训day5
    python实训day4
    python实训day3
    python实训day2
    python实训day1
    MyBatis入门-insert标签介绍及使用
    Shell入门-Shell脚本开发规范
  • 原文地址:https://www.cnblogs.com/hyamw/p/2139388.html
Copyright © 2011-2022 走看看