iOS UIScrollView UITouch 事件

2021-03-09  本文已影响0人  gaookey

新建继承 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];
    }
}
上一篇下一篇

猜你喜欢

热点阅读