菜鸟教程小白 发表于 2022-12-12 09:22:45

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


                                            <p><p>我怎样才能在 Storyboard 中实现这一点?</p>

<pre><code>[cell addConstraint:[NSLayoutConstraint constraintWithItem:nameLabel
                                                 attribute:NSLayoutAttributeRight
                                                 relatedBy:NSLayoutRelationEqual
                                                    toItem:cell.contentView
                                                 attribute:NSLayoutAttributeLeft
                                                multiplier:1.0
                                                constant:200.0]];
</code></pre></p>
                                    <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>很容易,在 Storyboard 中,控制单击 View 并拖动到另一个 View 。然后点击右侧约束的设置:</p>

<p> <img src="/image/p1WtG.png" alt="enter image description here"/> </p>

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

<p> <img src="/image/3jwg8.png" alt="enter image description here"/> </p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 如何在 Storyboard 中的 UILabel 的右边缘添加前导约束?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/23082110/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/23082110/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 如何在 Storyboard 中的 UILabel 的右边缘添加前导约束?