将滚动事件从uibutton传递到uiscrollview [英] pass scroll event from uibutton to uiscrollview

查看:166
本文介绍了将滚动事件从uibutton传递到uiscrollview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有水平 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆