I've seen a lot of Stack Overflow threads about this topic (and the iOS 6 release notes), but none have seemed to help me here, or I can't understand them. What I have is a scroll view of size (244, 46) that I want to scroll to twice its width with paging.
In my storyboard I've laid out the scroll view and its subviews (a row of UIButtons
) - I set their origins but removed all the constraints saying "Leading space to superview
." I replaced them with "Leading space to button" - the horizontal spacing between successive buttons. In code, I set the buttons' translatesAutoresizingMaskIntoConstraints to NO.
I can't get the scroll view to scroll, however. It just bounces to show that there is something on the right side of the scroll view's bounds, just out of reach. Is there anything I'm doing wrong, or something else I need to try to get this to work?
Oh, and there was also a "Trailing space to superview" constraint on the last visible button in Interface Builder (not the last button in the row), and a "Leading space to superview
" constraint on the first button that wouldn't stay deleted (see the purple constraint in the image). They annoyingly just popped up in a different spot in the list! Why does this happen, and why isn't the content size being set properly?
Thanks for your time!