Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
433 views
in Technique[技术] by (71.8m points)

swift - is there a way to make stacks of different sizes in the same stackview? or add the stack view to a container?

I am trying to create a stack view but I am having a hard time adding padding to the sides of the stacks like the photo. Is there a way to add add a stack view to a container (so I can add padding to inside of the container? In my version the [firstName, lastName etc] are all stuck to the side of the white container and when I add padding it is going to the stackView's total body (ie it is increasing the blue distance). I also want to make the sizes of the stacks different from one another (login button should be smaller than the text fields) and they're all coming out the same size. PS I am not using storyboards whatsoever. enter image description here


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Sure, u can just add your stack view as UIView subView. Just create new UIView, add it to you ViewController, and add your stackView same way to your UIView so u can constraint your stackView to your new UIView.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...