I am trying to create a view where I collect user information like first name, last name, DoB among others. The view when created in the storyboard looks like this --
However, setting constraints on each of these is turning out to be really unwieldy. I am very much inclined to creating this in code, and ofcourse it feels like too many lines even in code. There has to be a better way to do it.
What is the best way to do it? Do I put them in multiple stack views and then stack them up in additional stack views? What is the usual standard practice?
I am very new to iOS programming and searching on stackoverflow and google did not give me any results.
Use always stack view if you can, they are the best solution because they manage many issues for you. In this situation I will put:
Now it can be messy, but don't worry. You need to set the constraints and the stack view parameters to adjust. Try the different options, the only way to understand how to set up a correct stack view is to try. After sometime you'll able to create a complex interface in a few minutes.
For a better understanding see the documentation: https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/LayoutUsingStackViews.html
And watch this video from Apple:Autolayout Apple Video