gpt4 book ai didi

ios - 如何使用 AutoLayout 约束在 ios xcode 6.3 中的多个标签之间创建相等的间距

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:16:06 29 4
gpt4 key购买 nike

如何实现多个标签的自动布局,如图所示

enter image description here

我也需要在所有标签和边距之间保持相对相等的间距。我想在标签 1、2、3、4 之间保持相等的间距。我无法使用 AutoLayout 在多个 iPhone 版本的标签之间保持相对相等的间距。

我能够使用以下步骤解决:

Step1: Place the label or button you want to create inside a view and give that view constraint as below:

enter image description here

Step2: Select all the label or button you want to create and set constraint as below:

At First

enter image description here

At Second

enter image description here

At third

enter image description here

最佳答案

试试这个,让各种标签之间的间距相等,

 label1.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleBottomMargin;
label2.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleBottomMargin;
label3.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleBottomMargin;
label4.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin|UIViewAutoresizingFlexibleTopMargin|UIViewAutoresizingFlexibleBottomMargin;

关于ios - 如何使用 AutoLayout 约束在 ios xcode 6.3 中的多个标签之间创建相等的间距,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29789961/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com