简体   繁体   English

如何在情节提要中向 UILabel 的右边缘添加前导约束?

[英]How to add leading constraint to the right edge of the UILabel in storyboard?

How can I achieve the equivalent of this in storyboard?我怎样才能在故事板中达到这个效果?

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

Very easily, in storyboard, control click on view and drag to the other view.很容易,在情节提要中,控制单击视图并拖动到另一个视图。 Then click settings of the constraints on the right:然后点击右侧的约束设置:

在此处输入图片说明

and click on Select and edit which will take you to constraints settings:并单击“选择和编辑” ,这将带您进入约束设置:

在此处输入图片说明

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

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