简体   繁体   English

UIScrollView-输入超出可见区域

[英]UIScrollView - Input outwith visible area

I have a UIScrollView to which I add a bunch of UIImageView's as sub views. 我有一个UIScrollView,向其中添加了一堆UIImageView作为子视图。 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? 在这种情况下,我假设我必须使用内容偏移量,子视图位置等来计算是否阻止自己输入?

UImageView user interaction is not enabled as a default, so you probably enabled it somewhere. UImageView用户交互未默认启用,因此您可能在某处启用了它。 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. 您可以检查scrollview委托,以查看该imageview是否在标签的前面,如果看不见则将其禁用。

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

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