UIScrollView不能响应touch事件的解决办法

UIScrollView本身事是不支持touch的,我们可以给她添加拓展

#import "UIScrollView+util.h"

 

@implementation UIScrollView (util)

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

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

    [super touchesBegan:touches withEvent:event];

}

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

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

    [super touchesMoved:touches withEvent:event];

}

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

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

    [super touchesEnded:touches withEvent:event];

}

@end

转载于:https://www.cnblogs.com/vfeng/p/5108669.html

你可能感兴趣的:(UIScrollView不能响应touch事件的解决办法)