美文网首页
iOS UIScrollView UITouch 事件

iOS UIScrollView UITouch 事件

作者: gaookey | 来源:发表于2021-03-09 17:55 被阅读0次

新建继承 UIScrollView 的子类,重写 touch 方法

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

相关文章

网友评论

      本文标题:iOS UIScrollView UITouch 事件

      本文链接:https://www.haomeiwen.com/subject/dwebqltx.html