3
votes

MY app is for iPad using Storyboards with two scenes. On one scene, I have a UIScrollView that contains a UIVIew. It scrolls, but bounces back immediately, rendering itself useless. The size of the UIScrollView is 768x590; the size of the UIView is 768x1590; ContentSize of the UIScrollView is 768x590. This is an image of the UIScrollView settings: enter image description here

(I have looked at SO and Google for the past 6 hours, tried a lot of stuff, but nothing works. I have also done a CMD + Option + K (Clean) several times, and that didn't help either.

Why does it not scroll properly?

2

2 Answers

6
votes

Found what works for me!

When you embed a view into a UIScrollView in InterfaceBuilder, then there's a constraint automatically set. If your view is "longer" than the screen in portrait, it wont scroll at all.

But if you rotate the screen, you'll notice the ability to scroll a little.

To get UIScrollView going in AutoLayout look into your constraints.

Find "Vertical Space - Scroll View - View" and set it from "constant" to "auto" - fixed everything for me.

Thanks for your help... I appreciate it.

2
votes

Your scrollView height is less than the uiview which is the subview in your case of scrollview and for scrolling it fully you will have to set your scrollview contentSize height more than the height of the view you are scrolling in it,please give a check on this point.