Reputation: 139
obs: sorry if it's confusing, I'm not too good at english
I've started programming in the early 2016, so my first language is Swift and I created new project just for training AutoLayout stuff. I want the objects to fill the whole screen, so I did like this:
The buttons abc, 1-9, - and . measure 200x50. The reiniciar and calcular button (on the bottom) measure 300x50. The label delta is 600x120 and x1 & x2 are 600x60.
When I stack them individually, no problems. I got into this scene:
They're all stacked together and respecting the height x width
But I got in trouble when adding constraints to make them fill the hole screen. I set all the constraints margins to 0 (in order to stretch and fill) and I got this:
What am I doing wrong?
Upvotes: 1
Views: 42
Reputation: 2396
When you pin to the 4 edges of the superview, you will open the autolayout pin menu. When you open it, there is a checkbox beneath the 4 edges you can select. Remove your constraints and add them again with that checkbox unchecked, it says something like: constrain to margins.
Also check whether your stack view has some edge insets in the settings pane when you have selected the stack view. Edge Insets are basically margins inside of your stack view, set them to 0.
Please comment if that didn't solve your problem.
Upvotes: 1