質問

Hopefully somebody can help me out here. I have a UIView with 3 text fields. I want the "return" key from the keyboard to resign the first responder, regardless of which text field the users curser is in. My code works for 2 of the 3 text fields, but consistently (as in always) it refuses to resign first responder from the 3rd text field, and I don't know why (the text fields are identical. The field that does not work is the 3rd field...

Here is the code if it helps

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

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

    return YES;
}

Here is the property declaration in the H

@property (weak, nonatomic) IBOutlet UITextField *firstTimeTextField;
@property (weak, nonatomic) IBOutlet UITextField *secondTextField;
@property (weak, nonatomic) IBOutlet UITextField *thirdTextField;

It seems pretty straight forward, so I'm wondering if there is some kind of error checking that I should be doing to determine whats happening here.

The file is declared as a UITextFieldDelegate as well...

Thanks for the time and the assistance!

正しい解決策はありません

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top