tech74
tech74

Reputation: 1659

Prevent UISlider in UIScrollView from triggering scroll

Using Xcode 9, I have a UISlider as a subview of UIImageView within a horizontal scrolling UIScrollView. My problem is that when the user tries to swipe the slider the scroll action is activated.

Ideally I want the UIImageView and the nested slider not to activate scrolling when touched, only when the user swipes outside should scrolling be allowed. I tried setting the exclusiveTouch property on the slider and UIImageView but it made no difference.

   self.slider.exclusiveTouch = YES;

Thanks

Upvotes: 0

Views: 852

Answers (1)

Jake T.
Jake T.

Reputation: 4378

This answer suggests also setting canCancelContentTouches to NO in your UIScrollView in addition to setting exclusiveTouch on the individual views.

how to prevent a touch event passed to a UIView's superview?

Upvotes: 1

Related Questions