IOS: action with enter key of iPad KeyBoard IOS: action with enter key of iPad KeyBoard xcode xcode

IOS: action with enter key of iPad KeyBoard


You would typically assign your view controller as the text field's delegate and then implement the textFieldShouldReturn: method, e.g.:

- (BOOL)textFieldShouldReturn:(UITextField *)textField {    otherTextField.text = @"World"    return YES;}


You can do that by implementing the UITextFieldDelegate protocol in your controller. For instance you could do something like:

- (BOOL)textFieldShouldReturn:(UITextField *)textField {    if (textField == theFirstTextField && [textField.text isEqualToString:@"Hello"]) {        theSecondTextField.text = @"World";    }    return YES;}


Set your view controller to be the textfield's delegate then implement

-(BOOL)textFieldShouldReturn:(UITextField *)textField

this gets called when the enter button is pushed on the keyboard.