OGeek|极客世界-中国程序员成长平台

标题: ios - 如何在 Storyboard 中的 UILabel 的右边缘添加前导约束? [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 09:22
标题: ios - 如何在 Storyboard 中的 UILabel 的右边缘添加前导约束?

我怎样才能在 Storyboard 中实现这一点?

[cell addConstraint:[NSLayoutConstraint constraintWithItem:nameLabel
                                                 attribute:NSLayoutAttributeRight
                                                 relatedBy:NSLayoutRelationEqual
                                                    toItem:cell.contentView
                                                 attribute:NSLayoutAttributeLeft
                                                multiplier:1.0
                                                  constant:200.0]];



Best Answer-推荐答案


很容易,在 Storyboard 中,控制单击 View 并拖动到另一个 View 。然后点击右侧约束的设置:

enter image description here

然后点击选择和编辑,这将带您进入约束设置:

enter image description here

关于ios - 如何在 Storyboard 中的 UILabel 的右边缘添加前导约束?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23082110/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4