【问题标题】:When I want to change the value in the `UISlider`, the scrollView scrolls left instead of the slider当我想更改 `UISlider` 中的值时,scrollView 会向左滚动而不是滑块
【发布时间】:2016-06-14 11:30:54
【问题描述】:
我在UICollectionView滚动方向horizontal中有UISlider。
当我想更改UISlider 中的值时,scrollView 会向左滚动而不是滑块!!
我尝试将UITapGestureRecognizer/UISwipeGestureRecognizer 添加到滑块。
它没有帮助。
【问题讨论】:
标签:
ios
swift
uicollectionview
uislider
uitapgesturerecognizer
【解决方案1】:
现在可以了!我补充说:
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
}