Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/109.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/apache-spark/5.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 辞职第一响应者仅在一个文本字段中不工作_Ios_Xcode_Uitextfielddelegate - Fatal编程技术网

Ios 辞职第一响应者仅在一个文本字段中不工作

Ios 辞职第一响应者仅在一个文本字段中不工作,ios,xcode,uitextfielddelegate,Ios,Xcode,Uitextfielddelegate,希望有人能帮我。我有一个包含3个文本字段的UIView。我想让键盘上的“return”键退出第一响应程序,不管用户光标位于哪个文本字段中。我的代码适用于3个文本字段中的2个,但它始终(像往常一样)拒绝从第3个文本字段中退出第一响应者,我不知道为什么(文本字段是相同的。不起作用的字段是第3个字段 如果有帮助,下面是代码 - (BOOL)textFieldShouldReturn:(UITextField *)textField { [firstTextField resignFirstR

希望有人能帮我。我有一个包含3个文本字段的UIView。我想让键盘上的“return”键退出第一响应程序,不管用户光标位于哪个文本字段中。我的代码适用于3个文本字段中的2个,但它始终(像往常一样)拒绝从第3个文本字段中退出第一响应者,我不知道为什么(文本字段是相同的。不起作用的字段是第3个字段

如果有帮助,下面是代码

- (BOOL)textFieldShouldReturn:(UITextField *)textField {

    [firstTextField resignFirstResponder];
    [secondTextField resignFirstResponder];
    [thirdTextField resignFirstResponder];

    return YES;
}
这是H中的属性声明

@property (weak, nonatomic) IBOutlet UITextField *firstTimeTextField;
@property (weak, nonatomic) IBOutlet UITextField *secondTextField;
@property (weak, nonatomic) IBOutlet UITextField *thirdTextField;
这看起来很直截了当,所以我想知道我是否应该做一些错误检查来确定这里发生了什么

该文件也声明为UITextFieldDelegate


感谢您的时间和帮助!

您是否已将委托设置为所有UITextFields


将委托设置为所有UITextFields。

是否已将委托设置为所有UITextFields


将委托设置为所有UITextFields。

是否已将委托设置为所有UITextFields?并且不必从所有UITextFields调用resignFirstResponder。只需使用textField参数,即实际调用回调的参数。[textField resignFirstResponder].第三个ExtField是否也连接到IB?骨头头移动…是的,没错!我设置了前两个,然后回来添加了第三个,但从未设置代理…谢谢…我现在要去facepalm…自然错误。我已经做了几次思考。如果有帮助,请标记我的答案。您是否将代理设置为所有UITextFields?您呢不必从所有UITextFields调用resignFirstResponder。只需使用textField参数,即实际调用回调的参数。[textField resignFirstResponder].第三个TextField是否也与IB连接?骨头头移动…是的,没错!我设置了前两个,然后回来添加了第三个,但从未设置代理…谢谢…我现在要去facepalm…自然错误。我已经做了几次了。我想。如果有帮助,请标记我的答案。