简体   繁体   English

如何设置带有寻呼启用=是的UIScrollView的页面调度行为?

[英]How can I set the paging behavior of an UIScrollView with pagingEnabled=YES?

The documentation says: 该文件说:

If the value of the property is YES, the scroll view stops on multiples of the view bounds when the user scrolls. 如果该属性的值为YES,则当用户滚动时,滚动视图将在视图边界的倍数处停止。 The default value is NO. 默认值为“否”。

well it's really nice that it stops on multiples of the view bounds when the user scrolls ;) But how many multiples? 很好,当用户滚动时,它停在视图边界的倍数上;)但是有多少个倍数呢? how's that beeing calculated? 蜂是如何计算的? I get a really weird behavior. 我的行为很奇怪。 I have 15 little 50x50 images alligned vertically. 我有15个垂直排列的50x50小图像。 How can I set up that it would stop on every 50 units scrolled, or on every image? 如何设置它在每滚动50个单位或每个图像上停止一次? it does stop once on top, once in the middle and once at the end. 它确实一次停在顶部,一次停在中间,一次停在最后。 It's not the behavior I've expected. 这不是我所期望的行为。

it stops on every multiple of the bounds. 它在每个边界上停止。 Ie if your scrollview has bounds of 0,0,100,100 it will stop on every multiple of 100 until the end of the content area. 即,如果您的滚动视图的边界为0,0,100,100,它将停止在100的每一个倍数上,直到内容区域的末尾。 Assuming the origin is 0 (0*100) a single swipe gensture will sed you to 0,100 (or 100,0 or 100,100 if directionLock is not enabled). 假设原点为0(0 * 100),则一次滑动手势会将您引导至0,100(如果未启用directionLock,则为100,0或100,100)。

To debug this removely I'd need to see the bounds, content rect of your scrollview and the frames of all the subview images within the content frame. 要删除调试,我需要查看边界,滚动视图的内容rect以及内容框架内所有子视图图像的框架。

I suspect that your scrollview is scrolling to it's bounds multiples not the frames of your subviews - if they don't match up, you'll have to implement paging yourself. 我怀疑您的scrollview正在滚动到它的边界倍数而不是子视图的框架-如果它们不匹配,则必须自己实现分页。

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

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