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

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

    <tfoot id='L17c1'></tfoot><legend id='L17c1'><style id='L17c1'><dir id='L17c1'><q id='L17c1'></q></dir></style></legend>
    • <bdo id='L17c1'></bdo><ul id='L17c1'></ul>

      在容器视图中均匀分布多个视图

      时间:2023-05-19
        <tbody id='tNu84'></tbody>

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

        <bdo id='tNu84'></bdo><ul id='tNu84'></ul>
      • <small id='tNu84'></small><noframes id='tNu84'>

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

              • 本文介绍了在容器视图中均匀分布多个视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                自动布局让我的生活变得困难.理论上,当我切换时它会非常有用,但我似乎一直在努力.

                Auto Layout is making my life difficult. In theory, it was going to be really useful when I switched, but I seem to fight it all of the time.

                我制作了一个演示项目来尝试寻求帮助.有谁知道如何在调整视图大小时使视图之间的空间均匀增加或减少?

                I've made a demo project to try to find help. Does anyone know how to make the spaces between views increase or decrease evenly whenever the view is resized?

                这里是三个标签(手动垂直间隔):

                Here are three labels (manually spaced vertically even):

                我想要的是让他们在我旋转时均匀地调整间距(而不是视图大小).默认情况下,顶部和底部视图向中心挤压:

                What I want is for them to resize their spacing (not the view size) evenly when I rotate. By default, the top and bottom views squish towards the center:

                推荐答案

                所以我的方法允许您在界面生成器中执行此操作.您所做的是创建您已设置为同等匹配高度的间隔视图".然后将顶部和底部约束添加到标签(参见屏幕截图).

                So my approach allows you to do this in interface builder. What you do is create 'spacer views' that you have set to match heights equally. Then add top and bottom constraints to the labels (see the screenshot).

                更具体地说,我对Spacer View 1"有一个最高限制,以 superview 的高度约束低于 1000 的优先级并且高度等于所有其他spacer 视图".Spacer View 4"对超级视图有底部空间限制.每个标签对其最近的间隔视图"都有各自的顶部和底部约束.

                More specifically, I have a top constraint on 'Spacer View 1' to superview with a height constraint of lower priority than 1000 and with Height Equals to all of the other 'spacer views'. 'Spacer View 4' has a bottom space constraint to superview. Each label has a respective top and bottom constraints to its nearest 'spacer views'.

                注意:请确保您的标签上没有额外的顶部/底部空间限制以进行超级视图;只是空间视图"的那些.这将是可以满足的,因为顶部和底部约束分别在Space View 1"和Spacer View 4"上.

                Note: Be sure you DON'T have extra top/bottom space constraints on your labels to superview; just the ones to the 'space views'. This will be satisfiable since the top and bottom constraints are on 'Space View 1' and 'Spacer View 4' respectively.

                Duh 1:我复制了我的视图,只是将其置于横向模式,以便您可以看到它有效.

                Duh 1: I duplicated my view and merely put it in landscape mode so you could see that it worked.

                Duh 2:间隔视图"可能是透明的.

                Duh 2: The 'spacer views' could have been transparent.

                Duh 3:这种方法可以横向应用.

                Duh 3: This approach could be applied horizontally.

                这篇关于在容器视图中均匀分布多个视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:旋转Android上的活动重启 下一篇:Android:将imageview中的图像旋转一个角度

                相关文章

                  <bdo id='2dDrU'></bdo><ul id='2dDrU'></ul>

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

                    <small id='2dDrU'></small><noframes id='2dDrU'>

                    <tfoot id='2dDrU'></tfoot>