I have a (vertical) UISlider inside a UIScrollview. I\'d like to be able to change the value of the slider, and, without lifting my finger, scroll the scrollview left or right.
Have you tried subclassing UIScrollView
and implementing - (BOOL)touchesShouldCancelInContentView:(UIView *)view
? According to the Apple documentation:
// called before scrolling begins if touches have already been delivered to a subview of the scroll view. if it returns NO the touches will continue to be delivered to the subview and scrolling will not occur
// not called if canCancelContentTouches is NO. default returns YES if view isn't a UIControl
If you simply return NO
if the view
is your UISlider
, this may do what you want, assuming your UIScrollView
only scrolls horizontally. If this doesn't work, you likely will have to do custom touch handling (ie. overriding touchesBegan:withEvent:
, touchesChanged:withEvent:
, etc.) for both your UIScrollView
and your UISlider
.