Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 按下enter键时是否执行objective-c中的代码?_Ios_Objective C_Xcode_Button_Xcode6 - Fatal编程技术网

Ios 按下enter键时是否执行objective-c中的代码?

Ios 按下enter键时是否执行objective-c中的代码?,ios,objective-c,xcode,button,xcode6,Ios,Objective C,Xcode,Button,Xcode6,我正在Xcode 6中进行Objective-C Xcode项目。我有一个文本字段和一个按钮,按下时可以检查文本字段中的内容 但是,我希望代码在按下enter键而不是submit按钮时运行 我已经看到,您可以在Xcode中为按钮设置等效键,但是此选项在Xcode 6中似乎没有功能。您需要: 为文本字段设置委托 在代理对象中,handle-(BOOL)textField应返回:(UITextField*)textField,即当按下return键时执行需要执行的操作,如果不想处理文本字段的返回,则

我正在Xcode 6中进行Objective-C Xcode项目。我有一个文本字段和一个按钮,按下时可以检查文本字段中的内容

但是,我希望代码在按下enter键而不是submit按钮时运行

我已经看到,您可以在Xcode中为按钮设置等效键,但是此选项在Xcode 6中似乎没有功能。

您需要:

  • 为文本字段设置委托
  • 在代理对象中,handle
    -(BOOL)textField应返回:(UITextField*)textField
    ,即当按下return键时执行需要执行的操作,如果不想处理文本字段的返回,则返回
    YES
  • 您需要:

  • 为文本字段设置委托
  • 在代理对象中,handle
    -(BOOL)textField应返回:(UITextField*)textField
    ,即当按下return键时执行需要执行的操作,如果不想处理文本字段的返回,则返回
    YES
  • 您需要:

  • 为文本字段设置委托
  • 在代理对象中,handle
    -(BOOL)textField应返回:(UITextField*)textField
    ,即当按下return键时执行需要执行的操作,如果不想处理文本字段的返回,则返回
    YES
  • 您需要:

  • 为文本字段设置委托
  • 在代理对象中,handle
    -(BOOL)textField应返回:(UITextField*)textField
    ,即当按下return键时执行需要执行的操作,如果不想处理文本字段的返回,则返回
    YES

  • 实现textField委托方法

    -(BOOL)textFieldShouldReturn:(UITextField *)textField
    {
         [self callYourCodeWantToExecute];
         //return YES; // want to hide keyboard
         //return NO; // want keyboard
    }
    

    实现textField委托方法

    -(BOOL)textFieldShouldReturn:(UITextField *)textField
    {
         [self callYourCodeWantToExecute];
         //return YES; // want to hide keyboard
         //return NO; // want keyboard
    }
    

    实现textField委托方法

    -(BOOL)textFieldShouldReturn:(UITextField *)textField
    {
         [self callYourCodeWantToExecute];
         //return YES; // want to hide keyboard
         //return NO; // want keyboard
    }
    

    实现textField委托方法

    -(BOOL)textFieldShouldReturn:(UITextField *)textField
    {
         [self callYourCodeWantToExecute];
         //return YES; // want to hide keyboard
         //return NO; // want keyboard
    }
    

    首先将文件委托给UITextField,然后将此方法添加到代码中

    -(BOOL) textFieldShouldReturn:(UITextField *)textField
    {
       [textField resignFirstResponder];
    
       return YES;
    }
    

    首先将文件委托给UITextField,然后将此方法添加到代码中

    -(BOOL) textFieldShouldReturn:(UITextField *)textField
    {
       [textField resignFirstResponder];
    
       return YES;
    }
    

    首先将文件委托给UITextField,然后将此方法添加到代码中

    -(BOOL) textFieldShouldReturn:(UITextField *)textField
    {
       [textField resignFirstResponder];
    
       return YES;
    }
    

    首先将文件委托给UITextField,然后将此方法添加到代码中

    -(BOOL) textFieldShouldReturn:(UITextField *)textField
    {
       [textField resignFirstResponder];
    
       return YES;
    }
    

    按照以下步骤操作

  • 设置UITExtfield的委托
  • 如果有多个文本字段,则添加标记值
  • 现在调用UITextfield的委托方法,如下所示
  • 迅捷的


    希望这有帮助

    遵循以下步骤

  • 设置UITExtfield的委托
  • 如果有多个文本字段,则添加标记值
  • 现在调用UITextfield的委托方法,如下所示
  • 迅捷的


    希望这有帮助

    遵循以下步骤

  • 设置UITExtfield的委托
  • 如果有多个文本字段,则添加标记值
  • 现在调用UITextfield的委托方法,如下所示
  • 迅捷的


    希望这有帮助

    遵循以下步骤

  • 设置UITExtfield的委托
  • 如果有多个文本字段,则添加标记值
  • 现在调用UITextfield的委托方法,如下所示
  • 迅捷的


    希望这有帮助

    成为UITextField的委托,然后您将获得-[textFieldShouldReturn:]成为UITextField的委托,然后您将获得-[textFieldShouldReturn:]成为UITextField的委托,然后您将获得-[textFieldShouldReturn:]成为UITextField的委托,然后您将获得-[textFieldShouldReturn:]