在滚动视图中的 ImageView 上使用 GestureRecognizer
我有一个水平的分页滚动视图,其中包含多个视图控制器,每个视图控制器都包含一个 UIImageView。在每个视图控制器中,我向 ImageView 添加一个 Tap GestureRecognizer,以便在点击/双击图像时可以执行特定操作。
然而,ImageView 手势识别器似乎没有被触发,因此选择器没有被调用。
我预计这可能与 Imageview 位于滚动视图中有关,但我不知道从哪里开始。我需要做些什么来确保为滚动视图中的每个图像视图调用手势识别器?
感谢您的建议。
I have a horizontal, paged scroll view that houses multiple view controllers, each of which contains a UIImageView. Within each view controller, I am adding a Tap GestureRecognizer to the ImageView so I can perform a specific action when the image is tapped/double tapped.
However, the ImageView gesture recgonizers don't seem to be firing, and therefore the selectors are not getting called.
I anticipate it may have something to do with the Imageview's being housed in the scrollview, but I am not sure where to start. Is there anything specific I need to do to ensure that the gesture recognizer gets called for each imageview within the scrollview?
Thanks for your suggestions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许您的 UIImageView 未配置为接收用户交互
UIScrollView 内视图中的 UIgestureRecognizer
Perhaps your UIImageView is not configured to receive user interaction
UIgestureRecognizer in a view inside a UIScrollView