UIScrollView - 输入超出可见区域
我有一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
默认情况下未启用 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.