0

J'ai UISlider dans UICollectionView direction de défilement horizontal.Lorsque je veux changer la valeur dans le `UISlider`, le scrollView défile à gauche au lieu du curseur

Lorsque je veux changer la valeur dans le UISlider, scrollView défile à gauche au lieu du curseur !!

J'ai essayé d'ajouter UITapGestureRecognizer/UISwipeGestureRecognizer au curseur.

Cela n'a pas aidé.

+2

Ajoutez du code de votre. –

+0

C'est un problème commun. Jetez un oeil à ces réponses et essayez-les: http://stackoverflow.com/questions/5222998/uigesturerecognizer-blocks-subview-for-handling-touch-events – brigadir

+0

Merci, mais ce n'est pas exactement ce que je cherchais –

Répondre

0

Maintenant ça marche! J'ai ajouté:

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 
}