UIScrollView 总是回弹 [英] UIScrollView always snaps back
问题描述
我将一堆对象放入 UIScrollView 并且我没有问题:当我尝试滚动"到一些屏幕外对象时,只要我在拖动它后按住手指,它们就会出现,但是当我让你,UIScrollView 弹回到原来的位置.
I put a bunch of objects into a UIScrollView and I no have a problem: When I try to "scroll" to some off-screen objects, they appear so long as I am holding my finger down after dragging it, but when I let you, the UIScrollView snaps back to the original position.
有没有办法防止这种情况发生?发生这种情况时不会出现屏幕外的灰色区域,顺便说一句.
Is there a way to prevent this? No off-screen gray area is appaering when this happens, BTW.
谢谢.
推荐答案
你必须设置滚动视图的 contentSize
包含您的对象,因此它知道可滚动区域有多大是 - 在到达边缘并弹回之前可以自由滚动多远.
You have to set the scroll view's contentSize
to include your objects, so it knows how large the scrollable area is — how far to scroll freely before it hits the edge and bounces back.
这篇关于UIScrollView 总是回弹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!