0
votes

I have a UIScrollView configured like this :

canCancelContentTouches:YES    
delaysContentTouches:NO

Inside the UIScrollView, I have a few UIButtons (think thumbnails). If I click a button, the touch is detected and if I then start scrolling, the touch is cancelled on the UIButton as expected.

The issue I'm encountering is if I give the UIScrollView a good swing, and I stop the scrolling by simply touching the UIScrollView, once I touch a UIButton it will receive the touchesCancelled after approximately 1 second of holding the button, until I re-scroll the UIScrollView

The problem seems to come from the UIScrollView still thinking that it is getting dragged (which is false because i haven't moved yet on my last touch).

Strangely, if I disable bouncing via [UIScrollView setBounces:false] the issue is not there anymore. But I obviously lose the bounce, which is problematic.

I have tried a bunch of thing like disabling/re-enabling the scrollview, its gesture recognizer. I'm running out of ideas here.

1

1 Answers

0
votes

What you can do here when uibutton receives touch began you can set uiscrollview contentsize equal to uiscrollview superview size.

When uibutton receives touch end you can set uiscrollview contentsize back to what it was before.

By setting uiscrollview contentsize equal to uiscrollview superview size it will not allow uiscrollview content to move.