- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event;
//recursively calls -pointInside:withEvent:. point is in the receiver's coordinate system
- (BOOL)pointInside:(CGPoint)point withEvent:(nullable UIEvent *)event;
// default returns YES if point is in bounds
-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
UIView *result = [super hitTest:point withEvent:event];
if([result isKindOfClass:[UISlider class]] || [result isKindOfClass:[UIButton class]] || [result isKindOfClass:[UISwitch class]]){
_contentView.scrollEnabled = NO;
}else{
_contentView.scrollEnabled = YES;
}
return result ;
}
网友评论