<i id='swSnu'><tr id='swSnu'><dt id='swSnu'><q id='swSnu'><span id='swSnu'><b id='swSnu'><form id='swSnu'><ins id='swSnu'></ins><ul id='swSnu'></ul><sub id='swSnu'></sub></form><legend id='swSnu'></legend><bdo id='swSnu'><pre id='swSnu'><center id='swSnu'></center></pre></bdo></b><th id='swSnu'></th></span></q></dt></tr></i><div id='swSnu'><tfoot id='swSnu'></tfoot><dl id='swSnu'><fieldset id='swSnu'></fieldset></dl></div>
    • <bdo id='swSnu'></bdo><ul id='swSnu'></ul>
  • <legend id='swSnu'><style id='swSnu'><dir id='swSnu'><q id='swSnu'></q></dir></style></legend>

        <small id='swSnu'></small><noframes id='swSnu'>

        <tfoot id='swSnu'></tfoot>
      1. 具有两个不等式约束的歧义

        时间:2023-09-09

            <tbody id='i0GAM'></tbody>

          <small id='i0GAM'></small><noframes id='i0GAM'>

        1. <tfoot id='i0GAM'></tfoot>

            • <bdo id='i0GAM'></bdo><ul id='i0GAM'></ul>
            • <legend id='i0GAM'><style id='i0GAM'><dir id='i0GAM'><q id='i0GAM'></q></dir></style></legend>
            • <i id='i0GAM'><tr id='i0GAM'><dt id='i0GAM'><q id='i0GAM'><span id='i0GAM'><b id='i0GAM'><form id='i0GAM'><ins id='i0GAM'></ins><ul id='i0GAM'></ul><sub id='i0GAM'></sub></form><legend id='i0GAM'></legend><bdo id='i0GAM'><pre id='i0GAM'><center id='i0GAM'></center></pre></bdo></b><th id='i0GAM'></th></span></q></dt></tr></i><div id='i0GAM'><tfoot id='i0GAM'></tfoot><dl id='i0GAM'><fieldset id='i0GAM'></fieldset></dl></div>
                  本文介绍了具有两个不等式约束的歧义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我希望底视图距离图像其上方的标签至少 20 距离.标签是多行的,因此它可以比图像视图更高或更短,具体取决于有多少文本.当我添加两个到最近邻居的距离 >= 20"的约束(如屏幕截图所示)时,Xcode 告诉我约束不明确.

                  I want to have the bottom view be at least 20 away from both the image and the label above it. The label is multiline, so it can be taller or shorter than the image view, depending on how much text there is. When I add two "distance to nearest neighbour >= 20" constraints like shown in the screenshot, Xcode tells me constraints are ambiguous.

                  我该如何解决?

                  推荐答案

                  如果我理解您的要求,我认为您可以这样做:

                  I think you can do it like this, if I understand your requirements:

                  图像视图具有固定的宽度和高度,左侧和顶部的约束,以及底部视图的约束 =20优先级为 700.这很关键——这将设置该底部视图的 y 位置(其具有固定的高度和两侧的约束),但如果另一个具有更高优先级的约束使其移动,它将允许它移动得更低.具有更高优先级的约束是对标签的约束——它 >=20,优先级为 1000(标签还对图像视图的顶部、右侧和后沿有约束).

                  The image view has a fixed width and height, and constraints to the left side and top, as well as a constraint to the bottom view of =20 with a priority of 700. That's crucial -- that will set the y position of that bottom view (which has fixed height and constraints to the two sides), but will allow it to move lower if another constraint with higher priority makes it. That constraint with higher priority is the constraint to the label -- it's >=20 with priority of 1000 (the label also has constraints to the top, right side, and trailing edge of the image view).

                  这篇关于具有两个不等式约束的歧义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:ios自动布局:以编程方式设置宽度约束 下一篇:以编程方式更改视图尺寸时,自动布局似乎不起作用

                  相关文章

                      <tfoot id='He9y2'></tfoot>
                    1. <legend id='He9y2'><style id='He9y2'><dir id='He9y2'><q id='He9y2'></q></dir></style></legend>

                      <small id='He9y2'></small><noframes id='He9y2'>

                      <i id='He9y2'><tr id='He9y2'><dt id='He9y2'><q id='He9y2'><span id='He9y2'><b id='He9y2'><form id='He9y2'><ins id='He9y2'></ins><ul id='He9y2'></ul><sub id='He9y2'></sub></form><legend id='He9y2'></legend><bdo id='He9y2'><pre id='He9y2'><center id='He9y2'></center></pre></bdo></b><th id='He9y2'></th></span></q></dt></tr></i><div id='He9y2'><tfoot id='He9y2'></tfoot><dl id='He9y2'><fieldset id='He9y2'></fieldset></dl></div>
                        <bdo id='He9y2'></bdo><ul id='He9y2'></ul>