How to resize subviews of UIStackView in Xcode?

Every time I try to add something to a UIStackView in iOS it autosizes my subviews into something that is too small, so the text is being cut off.

How exactly is this StackView supposed to be used? All the guides said it was easy, just drag your subviews inside it, but I must be doing something wrong..

Before adding to StackView:

After Adding to StackView:


This is because stackview itself needs constraints. Add constraints to your stackview and then the stackview will take care of subviews.

In this case stackview is positioned horizontally and vertically center in container.

Let me know if there is still any issue.

链接地址: http://www.djcxy.com/p/31070.html

上一篇: 在lapply中保存地块

下一篇: 如何在Xcode中调整UIStackView的子视图?