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

    <tfoot id='YJbiE'></tfoot>

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

    • <bdo id='YJbiE'></bdo><ul id='YJbiE'></ul>

    1. 向 UIBarButtonItem 添加约束

      时间:2023-09-10

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

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

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

                本文介绍了向 UIBarButtonItem 添加约束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                Xcode 不允许我在 MainStoryBoard 中的 ViewController 上对 BarButtonItem 施加约束.如图所示,它显示在不可读的左侧太远.

                Xcode is not allowing me to put constraints on my BarButtonItem on a ViewController in the MainStoryBoard. It's appearing too far to the left where it's unreadable as shown in the image.

                下图显示了 BarButtonItem 的位置.它应该说项目".我还查看了 Xcode 上的预览分屏,它在 iPhone6 上看起来不错,但在 iPhone 4 上却不行(它在 iPhone 4 上被剪掉了一半,但在这里它被剪掉了 3/4s).在这里,我正在为 iPhone 6 运行,我明白了.

                The image below shows where the BarButtonItem is. It's supposed to say "Item". I also looked on the preview split screen on Xcode and it looked fine for the iPhone6 but not for the iPhone 4 (it's half cut on the iPhone 4 but here its 3/4s cut). Here I'm running for the iPhone 6 and i get that.

                如何在 Xcode 中添加约束或如何以编程方式将约束添加到此 BarButtonItem?

                How do I add constraints in Xcode or how do I add the constraints programmatically to this BarButtonItem?

                非常感谢任何帮助.

                推荐答案

                在您的 xib/故事板中拖放导航栏

                Drag and drop navigation bar in your xib / story board

                您可以根据您的要求向此导航栏添加约束.

                U can add constraints to this navigation bar as per your requirement.

                然后将 Bar Button Item 添加到导航栏

                Then add Bar Button Item to your navigation bar

                Bar Button Item 采用默认位置,您不能在此处合并自动布局.

                Bar Button Item takes it default position u cannot incorporate autolayout there.

                虽然如果你想要固定或灵活的条形按钮项目的位置,你可以使用固定的空格键按钮项目或灵活的空格键按钮项目.

                Although if u want positions of Bar Button Item Fixed or Flexible u can make use of Fixed Space Bar Button Item or Flexible Space Bar Button Item.

                如果位置是固定的,则在两个 Bar Button Item 之间拖动 Fixed Space Bar Button.如果位置不固定,则在您的两个 Bar Button Item 之间灵活拖动 Flexible Space Bar Button Item.

                If positions are fixed drag Fixed Space Bar Button between your two Bar Button Item's. And if positions is not fixed its flexible drag Flexible Space Bar Button Item between your two Bar Button Item's.

                编码愉快.. :)

                这篇关于向 UIBarButtonItem 添加约束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:以编程方式向导航控制器添加自动布局约束 下一篇:UILabel 在 UIView 内没有动画,使用了自动布局

                相关文章

                      <bdo id='45TO5'></bdo><ul id='45TO5'></ul>
                  1. <tfoot id='45TO5'></tfoot>

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

                    <legend id='45TO5'><style id='45TO5'><dir id='45TO5'><q id='45TO5'></q></dir></style></legend>