0

I have UISlider in UICollectionView scroll direction horizontal.

When I want to change the value in the UISlider, the scrollView scrolls left instead of the slider!!

I tried to add UITapGestureRecognizer/UISwipeGestureRecognizer to the slider.

It did not help.

Eric Aya
  • 69,473
  • 35
  • 181
  • 253

1 Answers1

0

Now it works! I added:

override func hitTest(point: CGPoint, withEvent event: UIEvent?) -> UIView? {

    if !self.userInteractionEnabled || self.hidden || self.alpha <= 0.01 {
        return nil
    }

    for subview:UIView in self.subviews{
        let convertedPoint:CGPoint = subview.convertPoint(point, fromView: self)
        if let hitTestView: UIView = subview.hitTest(convertedPoint, withEvent: event) {
            if viewRating.frame.contains(point){
                delegate!.stopScrollCollectionView(true)
            }else{
                delegate!.stopScrollCollectionView(false)
            }
            return hitTestView
        }
    }
    return self
}