• <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

        iOS Autolayout and UIToolbar/UIBarButtonItems(iOS 自动布局和 UIToolbar/UIBarButtonItems)

        <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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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屋-程序员
                  • <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'>

                            <tbody id='DdK5e'></tbody>
                          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>