I have two textfield, in first textfield I write "Hello" and when I push enter in iPad keyboard, I want that in second textfield appear "World"; How can I use enter to create an action in my application?
The enter/return key does the same action as hitting the button in the lower-right of the keyboard. In some apps, it sends a message or performs an action; in others, it generates a newline. Messages does the latter. You have to use the Send button on the screen to send a message.
In order to add a line break, simply bring up the iOS keyboard, hold down the 'Shift' key and then press the 'Return' key at the same time.
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; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With