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

    1. <small id='Yogky'></small><noframes id='Yogky'>

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

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

    3. <tfoot id='Yogky'></tfoot>

        iOS 自动布局和 UIToolbar/UIBarButtonItems

        时间:2023-09-11

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

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

                  <bdo id='D0EOQ'></bdo><ul id='D0EOQ'></ul>
                  <legend id='D0EOQ'><style id='D0EOQ'><dir id='D0EOQ'><q id='D0EOQ'></q></dir></style></legend>
                  本文介绍了iOS 自动布局和 UIToolbar/UIBarButtonItems的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个启用了自动布局的 iOS 视图,并且有一个 UIToolbar 和一个 UISearchBarUISegmentControl 包含在工具栏上.我希望 UISearchBar 具有灵活的宽度,因此我需要添加一个约束来强制执行此操作,但据我所知,您不能向 UIToolbar 中的项目添加约束界面生成器.选项全部禁用.

                  I have an iOS view with autolayout enabled and have a UIToolbar with a UISearchBar and UISegmentControl contained with the toolbar. I want the UISearchBar to have a flexible width so I need to add a constraint to force this, but from what I can tell you cannot add constraints to items in a UIToolbar in Interface Builder. The options are all disabled.

                  AutoLayout 之前,我会使用 autoresizingmasks 来完成.

                  Before AutoLayout I would accomplish this with autoresizingmasks.

                  UIToolbars/UINavigationBars中是否不允许有约束?

                  在使用自动布局时还能如何实现?

                  How else can this be accomplished when using autolayout?

                  推荐答案

                  自动布局约束仅适用于 UIViews 及其子类.

                  Autolayout constraints only work with UIViews and their subclasses.

                  虽然 UIToolbar 允许一些基于 UIView 的项目(例如 UISearchBarUISegmentedControl),但它们可能必须共存使用不继承自 UIViewUIBarButtonItems.

                  While UIToolbar allows some UIView based items (such as UISearchBar and UISegmentedControl) they may have to coexist with UIBarButtonItems which do not inherit from UIView.

                  在自动布局可以与 UIBarButtonItems 一起使用之前,请照常做.

                  Until autolayout can work with UIBarButtonItems, do as you have done.

                  您的替代方法是使用仅基于 UIViews 的小部件来滚动您自己的工具栏.

                  Your alternative is to roll your own toolbar with widgets based only on UIViews.

                  这篇关于iOS 自动布局和 UIToolbar/UIBarButtonItems的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:出现键盘时调整屏幕大小 下一篇:AutoLayout 视图使应用程序在 popViewController 上崩溃

                  相关文章

                • <legend id='DdK5e'><style id='DdK5e'><dir id='DdK5e'><q id='DdK5e'></q></dir></style></legend>
                • <tfoot id='DdK5e'></tfoot>

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

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