简体   繁体   English

理解UIView,UICollectionView,UITableView,UIScrollView的bounds属性时出现困惑

[英]confusion in understanding bounds property for UIView, UICollectionView, UITableView, UIScrollView

I have been seeing negative value in UICollectionView bounds "Y" value and its keep on reducing it when scrolls down and increasing to positive value when scroll up. 我一直看到UICollectionView边界“Y”值的负值,并且在向下滚动时继续减少它,向上滚动时增加到正值。

How does bounds values work in UICollectionView? 边界值如何在UICollectionView中工作?

as far as I know, bounds in UIView has constant X and Y values. 据我所知,UIView中的边界具有常数X和Y值。 Am I thinking in a wrong way? 我是以错误的方式思考的吗?

Could someone explain how bounds works in UIView, UITableView and UICollectionView and UIScrollView ? 有人可以解释边界在UIView,UITableView和UICollectionView以及UIScrollView中的工作原理吗?

For most UIView s, the bounds origin will always be (0,0). 对于大多数UIView ,边界原点总是(0,0)。 However, UITableView and UICollectionView are both subclasses of UIScrollView . 但是, UITableViewUICollectionView都是UIScrollView子类。 UIScrollView achieves its scrolling effect by changing the x and y values of the origin of its bounds. UIScrollView通过更改其边界原点的x和y值来实现其滚动效果。 Here's a nice article explaining in more depth: http://oleb.net/blog/2014/04/understanding-uiscrollview/ . 这是一篇很好的文章,更深入地解释: http//oleb.net/blog/2014/04/understanding-uiscrollview/

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

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