简体   繁体   English

如何在UIscrollView中获得当前控件位置?

[英]How to get current postion of control in UIscrollView?

在uiscrollview滚动了某个值之后,我想获得uiscrollview中控件的当前位置。

The position of your control in scrollview does not actually change with scrolling. 控件在scrollview中的位置实际上不会随着滚动而改变。 So: 所以:

yourSubview.frame is always fixed. yourSubview.frame始终是固定的。 You can check how much of the content is scrolled in scrollview by looking at: scrollview.contentOffset the contentOffset as you might guess starts default at CGPoint : (0,0) After you scroll this value gets updated accordingly. 您可以通过查看以下内容来检查滚动视图中滚动了多少内容: scrollview.contentOffset contentOffset,您可能会猜测默认开始于CGPoint:(0,0)滚动后,此值将相应更新。

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

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