UIScrollView - 输入超出可见区域

发布于 2024-08-19 12:35:00 字数 183 浏览 9 评论 0原文

我有一个 UIScrollView,我向其中添加了一堆 UIImageView 作为子视图。除了当子视图超出滚动视图的可见区域时我从子视图获得输入之外,一切都工作正常。我本以为默认情况下滚动视图会阻止任何事件到达可见区域之外的子视图,但我认为情况并非如此?

在这种情况下,我假设我必须使用内容偏移量、子视图位置等来计算是否自己阻止输入?

I have a UIScrollView to which I add a bunch of UIImageView's as sub views. Everything works fine apart from that I get input from the subviews when they are outwith the visible area of the scroll view. I would have thought the scroll view would prevent any events from reaching subviews outwith the visible area by default but I presume this isn't the case?

In which case I assume I have to use the content offset, subview positions etc. to calculate whether to prevent the input myself?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

猫腻 2024-08-26 12:35:00

默认情况下未启用 UImageView 用户交互,因此您可能在某处启用了它。您可以检查滚动视图委托以查看该图像视图是否位于标签前面,如果不可见则禁用它。

UImageView user interaction is not enabled as a default, so you probably enabled it somewhere. You could do a check on the scrollview delegate to see if that imageview is in front by a tag, and if it is not visible disable it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文