2016-06-14 39 views
0

我有UISliderUICollectionView滚动方向horizontal当我想改变`UISlider`中的值时,scrollView向左滚动而不是滑动条

当我想要更改UISlider中的值时,scrollView向左滚动而不是滑动!

我试着将UITapGestureRecognizer/UISwipeGestureRecognizer添加到滑块。

它没有帮助。

+2

添加你的一些代码。 –

+0

这是常见问题。看看这些答案,并尝试它们:http://stackoverflow.com/questions/5222998/uigesturerecognizer-blocks-subview-for-handling-touch-events – brigadir

+0

谢谢,但它不是我正在寻找 –

回答

0

现在,它的工作原理!我补充说:

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 
}