Is there a way to add a cancel button to the keyboard displayed for UITextField? Looking over the UITextInputTraits Protocol Reference, I could not find anything, including trying out the different keyboard types.
Is there a way to add a cancel button to the keyboard displayed for
Share
You can create a input accessory view which can display a UIToolBar Above the keyboard and then add a cancel button to this. Take a look at the documentation link below for the inputAccessoryView property.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UITextField_Class/Reference/UITextField.html
This is an example of one I did for a TextView. The create Input Accessory View method is called from “textViewDidBeginEditing”. Then it creates the input accessory view and in my case adds three buttons and a space bar.
I hope that helps.