<tfoot id='7uYYp'></tfoot><legend id='7uYYp'><style id='7uYYp'><dir id='7uYYp'><q id='7uYYp'></q></dir></style></legend>
      1. <small id='7uYYp'></small><noframes id='7uYYp'>

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

        iOS 7中文本字段的弹出/模式选择器

        Popup/modal picker for a text field in iOS 7(iOS 7中文本字段的弹出/模式选择器)
      2. <legend id='onlMR'><style id='onlMR'><dir id='onlMR'><q id='onlMR'></q></dir></style></legend>

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

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

                  本文介绍了iOS 7中文本字段的弹出/模式选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  I am having a lot of trouble figuring out how to implement a standard popup picker. Like many apps' registration screen when a user selects the birthday text field I'd like a popup picker to appear so that users can select their birthday, click done and the formatted date will be added to the text field. This doesn't seem like it should be all that hard, yet it seems there is no simple, clear, standard way of doing this in iOS 7.

                  I've searched the internet and seen some saying to use modals, others say actionsheets, others say popups and still others say a separate view controller.

                  Can anyone tell me what the standard way of doing this is or a snippet on how to implement it?

                  解决方案

                  I think the "standard" way, is to set the picker as the inputView of the text field.

                  UIPickerView *picker = [[UIPickerView alloc] init];
                  self.textField.inputView = picker;
                  

                  It will pop up front the bottom, just like the keyboard does when you touch in the text field.

                  Here's a simple implementation of how to use a picker as an input view:

                  @interface ViewController ()
                  @property (weak, nonatomic) IBOutlet UITextField *tf;
                  @property (strong,nonatomic) NSArray *theData;
                  @end
                  
                  @implementation ViewController
                  
                  - (void)viewDidLoad {
                      [super viewDidLoad];
                      UIPickerView *picker = [[UIPickerView alloc] init];
                      picker.dataSource = self;
                      picker.delegate = self;
                      self.tf.inputView = picker;
                      self.theData = @[@"one",@"two",@"three",@"four"];
                  }
                  
                  -(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
                      return self.theData.count;
                  }
                  
                  -(NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
                      return  1;
                  }
                  
                  -(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
                      return self.theData[row];
                  }
                  
                  -(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
                      self.tf.text = self.theData[row];
                      [self.tf resignFirstResponder];
                  }
                  

                  这篇关于iOS 7中文本字段的弹出/模式选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  iOS 6 rotations: supportedInterfaceOrientations doesn#180;t work?(iOS 6 旋转:supportedInterfaceOrientations 不起作用?)
                  CABasicAnimation rotate returns to original position(CABasicAnimation 旋转返回原始位置)
                  UITabBarController Rotation Issues in ios 6(ios 6 中的 UITabBarController 旋转问题)
                  iOS: How to run a function after Device has Rotated (Swift)(iOS:设备旋转后如何运行函数(Swift))
                  How to rotate an image 90 degrees on iOS?(如何在 iOS 上将图像旋转 90 度?)
                  iOS 8 Rotation Methods Deprecation - Backwards Compatibility(iOS 8 旋转方法弃用 - 向后兼容性)
                    <tbody id='t3ntx'></tbody>
                    <bdo id='t3ntx'></bdo><ul id='t3ntx'></ul>

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

                      <tfoot id='t3ntx'></tfoot>

                          1. <legend id='t3ntx'><style id='t3ntx'><dir id='t3ntx'><q id='t3ntx'></q></dir></style></legend>

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