ios - 如何向 Storyboard中 UILabel 的右边缘添加前导约束?

标签 ios objective-c uilabel autolayout

如何在 Storyboard中实现与此相同的效果?

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

最佳答案

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

enter image description here

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

enter image description here

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

相关文章:

ios - 几何程序在 iPad Mini 2 iOS 9 上不起作用

ios - 按钮标题在点击时被裁剪

ios - 如何禁用 UIPickerView (Objective-C)?

objective-c - 不规则形状的碰撞检测

ios - 如何使用动态大小更改 Swift 中 iOS 应用程序的字体?

iphone - 如何控制 MPMoviePlayerController 的播放部分

iOS SIGABRT 即将推出

objective-c - 无法打开,因为无法确认开发者身份

iphone - 使用手势缩放 UIlabel 文本

iphone - 以编程方式将 UILabel 添加到工具栏