Ios – How to disable/enable the return key in a UITextField


Is there a way to programmatically enable or disable the Return Key on the UIKeyboard? The closest I could find is enablesReturnKeyAutomatically, but that only will tell whether to disable it at all.

Best Solution

Maybe the following code segment helps:

textfield.enablesReturnKeyAutomatically = YES;

This is publicly available in iPhone SDK in UITextInputTraits. Using this, return key will be disabled when no input text is available within text field.