简体   繁体   English

确定子视图在UIScrollView中是否可见

[英]Determine if a subview is visible in a UIScrollView

I've added a view to my app, that contains a UIScrollView, with a number of UITextViews in it's content view. 我在我的应用程序中添加了一个视图,其中包含一个UIScrollView,其中包含许多UITextViews的内容视图。 This works perfectly on OS 3.0 and up, but when I test it on my 2.2.1 iPod touch, there is a UITextView bug that stops any text views automatically updating their content when they are scrolled into view - so you have to send them the setNeedsDisplay message. 这在OS 3.0及以上版本中运行良好,但是当我在2.2.1 iPod touch上测试时,有一个UITextView错误会阻止任何文本视图在滚动到视图时自动更新其内容 - 所以你必须发送它们setNeedsDisplay消息。

However, I only want to do this when they start to become visible during the scroll - how do I determine, in the UIScrollView's scrollViewDidScroll delegate method, whether a UITextView is visible in the UIScrollView's frame? 但是,我只想在滚动期间开始变为可见时才这样做 - 如何在UIScrollView的scrollViewDidScroll委托方法中确定UITextView在UIScrollView的框架中是否可见?

Ta. 助教。 Jools. 朱尔斯。

You have to do the calculation manually whenever the scroll view scrolls. 滚动视图滚动时,您必须手动进行计算。 This answer might help. 这个答案可能有帮助。

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

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