Search code examples
iphoneiosuiscrollviewuibutton

UIButton Doesn't allow UIScrollView to scroll


I have many UIButtons within a UIScrollView. Those UIButtons have actions attached to them in Touch Down Repeat. My problem is my scroll view doesn't scroll when I touch a button then scroll, but it works fine if I touch outside of the button.

How can I allow my scroll view to scroll even though a button is pressed?


Solution

  • As long as you have the Cancellable Content Touches in Interface Builder set it should work. You can also set it in code:

    scrollView.canCancelContentTouches = YES;