Changing text of done button in keyboard
You can't set it to arbitrary text, but you can make it a canned word by setting the returnKeyType
on whatever text field or view is being used for editing. Possible values of UIReturnKeyType
are here:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextInputTraits_Protocol/Reference/UITextInputTraits.html%23//apple_ref/occ/intf/UITextInputTraits
These are generally localized with the app, though. If your app supports an "fr" localization, and the device is set to French, you should get the localized versions of the keyboard keys.
I went crazy before I found out how to ask this question right.
First of all thanks to Ben Zotto and Emil for the answers. I just want to put some more details to it. As Ben Zotto points out you NEED to set the UIReturn key. Otherwise the keypad is not going to adapt the return button to the selected language. For programmatically created UITextField
s just add the following to the viewDidLoad
method:
yourTextField.returnKeyType = UIReturnKeyDone; //or all the other UIReturnKeys
And yes there is also the option to set the UIReturnKey
to UITextFields
created in Storyboard
. Select the textfield in the view controller and go to the Attributes inspector
and set the Return Key
to something else than "Default":
This might be simple to most of the iOS guys. But for beginners it is hard to find out that you need to change the default value to trigger the behavior you expect.