【问题标题】:UITapGestureRecognizer is overriding UIButton actions on ScrollviewUITapGestureRecognizer 正在覆盖 Scrollview 上的 UIButton 操作
【发布时间】:2010-07-20 22:59:48
【问题描述】:

我有一个带有按钮的 Scrollview。我有一个动作设置为 TouchupInside。最初工作正常。所以我需要 Scrollview 如果在 3 秒内没有被触摸,它会自动隐藏。为此,我在 Scrollview 上使用 UITapGestureRecognizer。如果您触摸 Scrollview 中的任何位置,它肯定会起作用。不幸的是 UIButton 不再起作用。 UITapGestureRecognizer 似乎取代了按钮。

任何想法如何让 UIButton 动作工作?

【问题讨论】:

    标签: uiscrollview uibutton


    【解决方案1】:

    您可以使用此行阻止 UITapGestureRecognizer 取消其他事件:

    tapRecognizer.cancelsTouchesInView = NO;

    为我工作:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-12-26
      • 2012-01-17
      • 2012-09-24
      • 1970-01-01
      • 2023-03-29
      相关资源
      最近更新 更多