2016-06-14 16 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 
} 
相關問題