开发者

UIScrollView with UIButton doesn't scroll when touch down on button

I've got a UIScrollView in my UIView. I've added some UIButtons to the scroll view.

If I touch down not on a button and drag, the scroll view drags fine. If I touch down on a button and drag then the scroll view doesn't move.

I want the scroll view to always scroll around if dragged and the buttons only get selected on the Touch Up Inside event.

I don't want to check "Delay Content开发者_StackOverflow Touches" because I don't want to have to wait for the delay.

Does anyone know what I need to do to get this to work?

Regards, Rich


Perhaps just outdated, but Redent84's answer is plain wrong.

You can solve this by adding:

scrollView.canCancelContentTouches = YES;


There's no automatic way of doing that. You have to manually handle the touch event, and then determine what the user wants to do, if he moves the finger X pixels up or down, then he wants to scroll, and if he releases the touch inside the button, then he probably wants to activate that action.

Regards!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜