Ok, so what I have is a UIScrollView that is constrained to all four sides of the main view, centered both vertically and horizontally, and set to have equal width and heigh
Avoid putting all your subviews directly inside the scrollView
. The autolayout will break apart.
You need to :
UIView
inside the UIScrollView
, with constraints 0
-0
-0
-0
to leading
-top
-bottom
-trailing
to the UIScrollView
, and put all your subViews inside that UIView
. After that, you need to set the contentSize
of your UIScrollView
by code.
Also, you can:
add missing constraints
to see what is missing. Check out Apple documentation for more details.