![](/img/trans.png)
[英]AutoLayout constraints for programmatically added buttons in a scrollView
[英]making buttons with the same spacing by giving Autolayout constraints
Steve 建議的 StackView 是一個不錯的解決方案。 或者,如果您想讓它在沒有 StackView 的情況下工作,請嘗試下面的代碼片段。
要在屏幕上水平均勻分布按鈕,請使用以下示例,3 個按鈕:
"H:|[spacer0(>=0)][button0][spacer1(==spacer0)][button1(==button0)][spacer2(==spacer0)][button2(==button0)][spacer3(==spacer0)]|"
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.