Anyone please suggest which contraint combination is best for getting this desired output. It must be suitable for both iPad and iPhones. First I set the label To in the center of the container and set contrainst for all other controls based on that. But the problem is there are lot more space left and the design looks not good.
Asked
Active
Viewed 59 times
1 Answers
2
I would have one Horizontal UIStackView
with Distribution Fill Equally and inside I would put two horizontal UIStackView
s with Distributions Fill. Inside each I would put UILabel
and then UITextField
.
Spacing between label and text field (or between stack views) you can set by setting spacing of its related stack view. Or you can set distribution to Fill Proportionally and then set aspect ratio for label and text field widths
So, constraints which you need are constraints for main stack view.

Community
- 1
- 1

Robert Dresler
- 10,580
- 2
- 22
- 40
-
Is the inner stackviews requires any contraints ? – SIDHARTH P U Mar 06 '19 at 06:34
-
1@SIDHARTHPU you can set spacing between or set dirstribution fill proportionally and then set aspect ratio For label and text field width – Robert Dresler Mar 06 '19 at 06:37
-
I also need calender icon inside both text field. – SIDHARTH P U Mar 06 '19 at 06:44
-
@SIDHARTHPU I would look for something called left view in text field. Check [this](https://stackoverflow.com/questions/27903500/swift-add-icon-image-in-uitextfield) – Robert Dresler Mar 06 '19 at 07:40