Reputation: 35
I have just started learning swift and have been trying to create a layout using the scoreboard.
I have placed two textfields and set the constraints properly using the document outline. However when I run the emulator the Text Fields display wrong.
I have attached a screenshot, The left is what happens in my emulator the right is what I see in the view editor in xCode
Upvotes: 2
Views: 2866
Reputation: 22374
You used the wrong constraints.....as you give x and y position to edges of the screen you can not maintain the width of the textview...
ok here is some images ...just follow it...
In first image i just give x and y position with height and width to first textfield and in the second one i give equal width and heigh to first one.
Upvotes: 3
Reputation: 5536
You used the wrong constraints. You set it so its constant inset from the two sides. If the screen gets small, the constant inset stays the same and it squeezes the textField
.
You want to keep a constant width of the textField
so no matter what size the screen is, it will keep the constant width.
Upvotes: 0