繁体   English   中英

仅在ScrollView中滚动运动结束时点击工作

[英]Tap working only at the end of the scroll movement in ScrollView

我的项目涉及iPhone的Xcode IOS 10+,语言是ObjectiveC。

我创建了一个包括内容视图的ScrollView。 在内容视图中,有一个与TapGestureRecognizer关联的UIImageView。 所有这些都是通过StoryBoard进行可视化制作的。

只要滚动运动结束,TapGestureRecognizers都可以工作。 否则,如果用户滚动,则无法点击。

已启用UserInterraction标志,Delays Content Touches标志已设置为false。 但是它没有用。

你们中的任何人都会遇到类似的问题,您将如何解决?

我认为滚动视图在滚动时会消耗点击手势,因为它用于停止滚动运动。 尝试在您的UITapGestureRecognizer上设置委托,并响应委托方法shouldRecognizeSimultaneouslyWithGestureRecognizer。

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    // Possibly check for your two gesture recognizer here
    return YES;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM