简体   繁体   English

使用AutoLayout调整UIStackView的大小

[英]Resizing a UIStackView using AutoLayout

I have the following setup in my storyboard. 我的故事板上有以下设置。 I want the selected UIStackView to stretch across it's parents view so its right edge is the same distance away from the edge of the screen as the left edge. 我希望所选的UIStackView在其父视图上延伸,以便其右边缘与屏幕边缘的距离与左边缘的距离相同。

Control dragging from the stackview to it's parent view and selecting "Trailing space to container margin" doesn't do what I thought it would (I am very new to auto layout). 控件从stackview拖动到其父视图,然后选择“将空间拖到容器边距”并没有达到我的预期(我对自动布局非常陌生)。 What is the correct way to resize this stackview? 调整此stackview大小的正确方法是什么? TIA TIA

在此处输入图片说明

Control click and drag form your stackView to it's superview. 控制单击并从您的stackView拖动到其Superview。 Then pick Center Horizontally . 然后选择水平居中 Adding a leading constraint should be sufficient. 添加前导约束应该足够了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM