问题描述
我有水平 UIScrollView
,它是从 UIScrollView
扩展而且我添加了 UIButtons
水平。我只能滚出按钮区域,但如果我想滚动任何按钮,则会触发 UIControlEventTouchUpInside
事件。我不想要这个。我想点击 UIControlEventTouchUpInside
动作如果我点击,我想滚动,如果我滚动。
i have horizontal UIScrollView
which is extended from UIScrollView
and i added UIButtons
horizontally. i can only scroll out of the buttons area, but if i want to scroll over any buttons is fires UIControlEventTouchUpInside
event. I don't want this. i want to fire UIControlEventTouchUpInside
action if i click and i want to scroll if i scroll.
那么我怎么能将滚动事件从 UIButton
传递到 UIScrollView
?
so how can i pass scroll event from UIButton
to UIScrollView
?
推荐答案
子类UIScrollView,在中返回YES - touchesShouldCancelInContentView:
方法。
Subclass UIScrollView, return YES in the - touchesShouldCancelInContentView:
method.
这篇关于将滚动事件从uibutton传递到uiscrollview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!