UICollectionView uiscrollview等与uislider滑动事件冲突

  • (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 ;
}

推荐一个linux命令行网站:https://rootopen.com

你可能感兴趣的:(UICollectionView uiscrollview等与uislider滑动事件冲突)