给UIScrollView写一个延展 

.h文件实现:

@interface UIScrollView (NSFoundation)

@end

.m文件实现

@implementation UIScrollView (ScrollTouch)

//重写touchesBegin方法   

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{

//主要代码实现:

    [[self nextResponder] touchesBegan:touches withEvent:event];

//super调用,别漏

    [super touchesBegan:touches withEvent:event];

}

 

//重写touchesEnded方法   

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {

[[self nextResponder] touchesEnded:touches withEvent:event];

[super touchesEnded:touches withEvent:event];

}

 

//重写touchesMoved方法   

-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {

[[self nextResponder] touchesMoved:touches withEvent:event];

[super touchesMoved:touches withEvent:event];

}

 

 

 

@end

 

 

 

相关文章:

  • 2022-02-26
  • 2021-04-01
  • 2021-10-31
  • 2022-01-22
  • 2022-02-07
  • 2022-03-05
  • 2022-02-24
猜你喜欢
  • 2021-12-28
  • 2022-12-23
  • 2021-10-08
  • 2022-01-09
  • 2022-12-23
相关资源
相似解决方案