• <small id='Y7XL5'></small><noframes id='Y7XL5'>

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

  • <legend id='Y7XL5'><style id='Y7XL5'><dir id='Y7XL5'><q id='Y7XL5'></q></dir></style></legend>

      1. 如何在单击 UIButton 时添加 UITextfield 并使其可编辑

        时间:2023-07-06
          • <tfoot id='e6E5j'></tfoot>
              <tbody id='e6E5j'></tbody>
            <legend id='e6E5j'><style id='e6E5j'><dir id='e6E5j'><q id='e6E5j'></q></dir></style></legend>
              <bdo id='e6E5j'></bdo><ul id='e6E5j'></ul>

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

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

                • 本文介绍了如何在单击 UIButton 时添加 UITextfield 并使其可编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我有一个 UIButton,我正在尝试开发一个 UIButton 的可编辑 UITextField onclick.基本上,我希望用户单击按钮并编辑文本并将其保存以供将来使用.

                  I have a UIButton and I am trying to develop an editable UITextField onclick of UIButton. Basically, I want the user to click on the button and edit the text and save it for future use.

                  所以目前我有:

                  [notes_button addTarget:self action:@selector(editNote) forControlEvents:UIControlEventTouchUpInside];
                  

                  我不知道如何获得像 UITextField onclick 这样的弹出窗口并在 editNote 函数中添加 UITextField.

                  I am not sure how to get a popup like UITextField onclick and add UITextField in editNote function.

                  推荐答案

                  试试这个.首先让您的文本字段隐藏在 viewdidload - 然后在按钮按下时,将其淡入......使其可编辑,并为用户弹出键盘.

                  Try this. First make your textfield hide on viewdidload - then on button push, fade it in.. make it editable, and pop up keyboard for user.

                  //viewDidLoad
                  
                  yourTextField.alpha = 0;
                  yourTextField.userInteractionEnabled = FALSE;
                  
                  -(void)editNote {
                  
                              //fade in text field after button push
                              [UIView beginAnimations:nil context:NULL];
                              [UIView setAnimationDelay:0];
                              [UIView setAnimationDuration:0.75];
                              yourTextField.alpha = 1;
                  
                              [UIView commitAnimations];
                  
                             //make text field editable
                             yourTextField.userInteractionEnabled = TRUE;
                  
                            //pop up keyboard
                             [yourTextField becomeFirstResponder];
                  
                  }
                  

                  -------更新--------

                  现在您已经描述了您想要做得更好的事情.您将希望在这个新的视图控制器上创建一个带有字段(UITextFields 等)的全新 ViewController.

                  Now that you have described what you are trying to do a little better. You will want to create an entirely new ViewController with the fields (UITextFields etc) on this new view controller.

                  点击按钮后,您将编码:

                  On button click you will code:

                  TextFieldViewController * vc = [(TextFieldViewController *)[[TextFieldViewController alloc] init] autorelease];
                  [self.navigationController presentModalViewController:vc animated:YES];
                  [vc release];
                  
                  //you will need to create a button on this new ViewController and use this code to dismiss it when done.
                  
                  [[self parentViewController] dismissModalViewControllerAnimated:YES];
                  

                  这篇关于如何在单击 UIButton 时添加 UITextfield 并使其可编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:奇怪的 UIButton 行为:这正常吗? 下一篇:UIButton动作不起作用ios

                  相关文章

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

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

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