Weird behavior with Auto Layout and UIScrollView paging

625 Views Asked by At

I'm trying to have a horizontally scrolling UIScrollView with horizontal paging (kinda like a UIPageController but managed by a single UIViewController)

Because I'm using Auto Layout I have set up everything by using constraints for the views inside, and the scrollview works just fine. However what is odd is that the paging works in a weird way.

Specifically the scrolling becomes really slow and it takes over 5 seconds for the scroll view to snap in place. I am absolutely puzzled by this because I have done this before with a smaller view (about three "pages" as opposed to 6) and it worked flawlessly.

I have created a sample project to illustrate this; just build it and try scrolling left and right - it works best if you just flick once.
http://mbx.cm/t/MmLIi

The only thing that seems to prevent this is having the viewcontroller manage the scrollview directly (as opposed to have it inside a UIView), but I'm sure the problem lies elsewhere so I figured I'd try my luck to see if any Auto Layout gurus can help me out on this one.

1

There are 1 best solutions below

0
On BEST ANSWER

All I did was change your view controller's "Simulated Size" to "Fixed" instead of "Freeform" in the storyboard and it worked fine after that. Not really sure why that would change anything, but it did!