I've been learning how to make iOS apps, and have come across a minor annoyance. I can't find an easy way to align my text inputs.
Looking at the below screenshot, you will see that I've managed to align my text fields, which is what I want.
However, I did this manually by changing the individual Leading Space between each Label and Text Field.
My question is, how can I dynamically align my text fields?
Anand has posted nice way, but I personally use equal widths and heights in this kind of situation. So let's make a brief of it:
1) First, put constraints onto the age label:
2) Put constraints onto the top right textfield:
horizontal spacing c.
3) Then, make a second row of you elements - place second label and second textfield approximately of the same width and height in storyboard (with IB you can fix it later using magic function Update frames).
4) Then, set this for your
5) The same repeat width your second textfield. You don't have to make spacing constraint in the second step.
FINISH Now all four items are aligned.
If you want to change height of labels for example, just select the height constraint of it and your other labels will follow this change as well.
So final experience is here in this animation: