The size of the scroll area scrollView will be set by the restrictions of its subzones.
You have 2 restrictions that you can use to indicate the height of the scrollable area:
"V:|-415-[imageView]|"
This tells Auto Layout to place your image at 415 points from the top of its supervisor and put 0 points from the bottom of its supervisor. It does not determine the height, but Auto Layout will use the height of the image contained in the imageView, without any other restrictions. Note that the View image can be stretched, if necessary, to meet other restrictions.
"V:|[imageView1]-150-|"
This tells the auto layout to place your image at 0 points from the top of its supervisor and 150 points from the bottom of its supervisor. He does not determine the height. Because of this, one of the images can be stretched in Auto Layout to satisfy both limitations.
Instead, you should provide information on how the images are spaced apart. For instance:
"V:|-20-[imageView1]-20-[imageView]-20-|"
If you add these images one at a time, you do not need to specify this at a time. You can add the following restrictions:
"V:|-20-[imageView1]"
"imageView1 - 20 points from the top of the supervisor"
"V:[imageView1]-20-[imageView]"
"imageView 20 pips below imageView1"
"V:[imageView]-20-|"
"imageView - 20 points from the bottom of the supervisor"
When you have limited all the views of the images to each other and at the top and bottom of the scrollView, Auto Layout will be able to calculate the height of the scrollView.
You will have a similar problem with your widths. You have limited both images on both sides of the supervisor:
"H:|-20-[imageView]|"
"H:|[imageView1]-20-|"
Because of this, Auto Layout will stretch one of your images to fit the constraints. Only the widest image should be used to indicate the width of the scrollView. All others should be limited only to the left edge of the supervisor and lower the end | .
Again, if you add these images one at a time, and you donβt know what is the widest until you have added them, keep track of the widest that you have seen so far and limit the images to the left only. Then, when you're done, add a constraint to set the width of the scroll area based on the widest view:
"H:|-20-[imageView]-20-|"