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

    <legend id='Dpm2M'><style id='Dpm2M'><dir id='Dpm2M'><q id='Dpm2M'></q></dir></style></legend>

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

      如何在 iOS 自动布局中为按钮添加等间距和等宽

      How to add Equal Spacing and equal width for button in iOS Auto layout(如何在 iOS 自动布局中为按钮添加等间距和等宽)

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

              • <small id='6MEoN'></small><noframes id='6MEoN'>

                <legend id='6MEoN'><style id='6MEoN'><dir id='6MEoN'><q id='6MEoN'></q></dir></style></legend>
                本文介绍了如何在 iOS 自动布局中为按钮添加等间距和等宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我是 Xcode 中自动布局约束的新手.我有一个底部视图,例如 UITabBar 和 6 个 UIButtons.在没有限制的情况下,我将这些按钮与每个按钮的 5 个空格填充对齐,每个按钮的宽度为 50.现在,我正在尝试通过使用自动布局来支持所有屏幕尺寸.

                Am new to Auto layout constraints in Xcode. I have one Bottom View like UITabBar with 6 UIButtons. Without constraints I aligned those buttons with 5 space padding with each buttons and each buttons has 50 width. Now,I am trying to make it by using Auto layout to support all Screen sizes.

                在 Storyboard 约束中,我为 6 个按钮设置了相等的宽度,我做了 60 个每个按钮之间的空间.我将第一个按钮 0 设置为前导空格和我将最后一个按钮 0 设置为尾部约束.

                In Storyboard constrains I set equal width for 6 buttons and I made 60 space between each buttons. I set first button 0 to leading space and I set the last button 0 to tail constraints.

                我希望所有设备尺寸的视图之间的 按钮具有相同的宽度和灵活的空间.

                I want the buttons with equal width and flexible spaces between views in all device sizes.

                谁能帮帮我?寻求帮助.提前致谢.

                Can anyone pleas help me? Looking for the help. Thanks in advance.

                推荐答案

                检查这张图片并做出如下约束...

                check this image and made your constraints like below...

                结果:-不同尺寸的预览

                使用 Stackview(适用于 iOS 9.0 及更高版本)

                With Stackview (For iOS 9.0 and above)

                注意:如果您必须为 iOS 9 及更高版本制作应用程序,那么 UIStackView 是您的另一个选择

                NOTE: If you have to make app for iOS 9 and later then UIStackView is another option for you

                这篇关于如何在 iOS 自动布局中为按钮添加等间距和等宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                iOS AutoLayout - get frame size width(iOS AutoLayout - 获取帧大小宽度)
                Auto layout constraints issue on iOS7 in UITableViewCell(UITableViewCell中iOS7上的自动布局约束问题)
                How to resize superview to fit all subviews with autolayout?(如何调整超级视图的大小以适应所有具有自动布局的子视图?)
                Springs in Auto Layout: Distribute views evenly, with constraints, in Xcode 5(自动布局中的弹簧:在 Xcode 5 中使用约束均匀分布视图)
                reloadData() of UITableView with Dynamic cell heights causes jumpy scrolling(具有动态单元格高度的 UITableView 的 reloadData() 导致跳跃滚动)
                What is NSLayoutConstraint quot;UIView-Encapsulated-Layout-Heightquot; and how should I go about forcing it to recalculate cleanly?(什么是 NSLayoutConstraint“UIView-Encapsulated-Layout-Height?我应该如何强制它干净地重新计算?) - IT屋-程序员
                    <bdo id='0QPKv'></bdo><ul id='0QPKv'></ul>
                    <i id='0QPKv'><tr id='0QPKv'><dt id='0QPKv'><q id='0QPKv'><span id='0QPKv'><b id='0QPKv'><form id='0QPKv'><ins id='0QPKv'></ins><ul id='0QPKv'></ul><sub id='0QPKv'></sub></form><legend id='0QPKv'></legend><bdo id='0QPKv'><pre id='0QPKv'><center id='0QPKv'></center></pre></bdo></b><th id='0QPKv'></th></span></q></dt></tr></i><div id='0QPKv'><tfoot id='0QPKv'></tfoot><dl id='0QPKv'><fieldset id='0QPKv'></fieldset></dl></div>
                  • <tfoot id='0QPKv'></tfoot>

                  • <legend id='0QPKv'><style id='0QPKv'><dir id='0QPKv'><q id='0QPKv'></q></dir></style></legend>

                    <small id='0QPKv'></small><noframes id='0QPKv'>

                            <tbody id='0QPKv'></tbody>