Reputation: 1353
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.
Thanks.
Upvotes: 7
Views: 14824
Reputation: 607
Try adding a Content Size Fitter component to the Scroll View's Content object and set its scroll direction (Horizontal Fit or Vertical Fit) to Preferred Size.
Upvotes: 4
Reputation: 118651
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.
Upvotes: 9