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

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

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

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

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

        如何在 Interface Builder 中使用自动布局创建键盘附件视图?

        How do I create a keyboard accessory view with Auto Layout in Interface Builder?(如何在 Interface Builder 中使用自动布局创建键盘附件视图?)

        <tfoot id='VAnML'></tfoot>
        • <bdo id='VAnML'></bdo><ul id='VAnML'></ul>
            <tbody id='VAnML'></tbody>

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

                  本文介绍了如何在 Interface Builder 中使用自动布局创建键盘附件视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我想将完成"按钮和分段控件添加到小数点键盘.理想情况下,我想在 Interface Builder 中使用 Auto Layout 布局键盘附件视图.

                  I want to add a "Done" button and a segmented control to a Decimal Pad keyboard. Ideally I would like to lay out a keyboard accessory view with Auto Layout in Interface Builder.

                  这甚至可能吗?我是创建一个新的 XIB 还是可以在现有的 Storyboard 场景中以某种方式进行?如何将附件视图附加到相应的文本字段?

                  Is this even possible? Do I create a new XIB or can I do it in the existing Storyboard scene somehow? How do I attach the accessory view to the appropriate text field?

                  推荐答案

                  您介意以编程方式进行吗?

                  Would you mind doing it programmatically?

                  通常,您将 UIToolbar 与您的项目一起带到 UITextField,但您可能需要对 UISegmentedControl 进行子视图;

                  Typically you take a UIToolbar to a UITextField with your items, but you may need to subview the UISegmentedControl;

                  UIToolbar *keyboardToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 44)];
                  
                  UISegmentedControl *segmentedControl = [[UISegmentedControl alloc] initWithFrame:...
                  // Customize segmentedControl's properties here.
                  
                  UIBarButtonItem *flexibleSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
                  UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStylePlain target:self action:@selector(doneButtonPressed)];
                  
                  [keyboardToolbar setItems:[NSArray arrayWithObjects:flexibleSpace, doneButton, nil]];
                  [keyboardToolbar addSubview:segmentedControl];
                  [textField setInputAccessoryView:keyboardToolbar];
                  

                  最初可以在 IB 中创建工具栏,但您必须将其拖出视图并拖到包含场景的左侧边栏并将其链接到参考插座,然后使用 setInputAccessoryView 分配它 在你的 viewDidLoad 中.

                  It is possible to create the toolbar initially in IB, but you have to drag it off the view and to the left hand sidebar containing the scene and link it to a reference outlet, then assign it with setInputAccessoryView in your viewDidLoad.

                  这篇关于如何在 Interface Builder 中使用自动布局创建键盘附件视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

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

                      <tbody id='l8w2X'></tbody>
                    <legend id='l8w2X'><style id='l8w2X'><dir id='l8w2X'><q id='l8w2X'></q></dir></style></legend>

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

                            <bdo id='l8w2X'></bdo><ul id='l8w2X'></ul>