2
votes

I have seen many similar questions to this but none help me exactly. I have many vertical UISliders filling a wide UIScrollView. If I drag the thumb on the slider I want the horizontal UIScrollView to be locked and only allow vertical sliding. If I drag the UISlider other than on the thumb I want the horizontal UIScrollView scrolling. It currently works if I touch the thumb before dragging.

I have overridden touchesShouldCancelInContentView in the scroll view but never hit the breakpoint in that method.

1
I am getting nearer by starting with the scroll view scroll disabled and then only allowing it if I touch something other than the thumb. This feels backwards to me and means that everything I put on the scroll window needs to explicitly enable horizontal scrolling. - Ant
That didn't work because the touch that enabled scrolling was not used by the scroll view to scroll. A second finger scrolled. - Ant
UIScrollView documentation says: To make this determination, it temporarily intercepts a touch-down event by starting a timer and, before the timer fires, seeing if the touching finger makes any movement. I want to override the decision to allow scrolling on movement if the touch down was on the thumb area. - Ant

1 Answers

2
votes

I had to override touchesShouldBegin:withEvent:inContentView and also set delaysContentTouches to NO to intercept the touch message.