Views in ScrollView doesn't respect constraint

2019-08-22 06:36发布

问题:

I added a ScrollView to my View Controller. Then, I created constraints between my inner elements and the scroll view itself, but I don't understand why my yellow view for example is not taking the full width.

Here is the screenshot of my view and constraints:

And sometimes I get this, why?

When I don't use Scroll View, all works perfectly.

回答1:

Control drag from the mapView to the outer main View and select Equal-Widths