【问题标题】:touchesEnded broke UIScrollViewtouchesEnded 坏了 UIScrollView
【发布时间】:2014-11-29 08:43:39
【问题描述】:

我有一个 UIButton 容器实现:

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event

我的容器有子容器,其中一个包含UIScrollView

但是我的卷轴坏了。

如何在不删除 touchesEnded 方法的情况下处理我的滚动?

【问题讨论】:

  • 容器 UIView 是否在滚动视图上方带有 touchesEnded 方法?
  • 不,这就是问题
  • @Andy 我编辑了我的帖子。对不起,我的容器是 un UIButton。那么基本上,如何通过 UIButton 事件来实现我的滚动?
  • @Andy 我知道......但这是一个老项目,我别无选择。

标签: ios objective-c uiscrollview uikit


【解决方案1】:

您可以尝试实现以下委托方法:-

- (void)scrollViewDidScroll:(UIScrollView *)sender{
  //executes when you scroll the scrollView
}

在此方法中,您可以设置标志,然后您可以在touchesEnded 方法中检查相同的标志,以避免内部编写代码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-28
    • 2012-09-12
    • 2021-04-20
    • 2019-11-04
    相关资源
    最近更新 更多